SAP ABAP System Variables

Author | Last Updated| | 0 Comments Facebook Share Twitter Share Google Plus Share A+ A-


Working with system variables in SAP ABAP, SAP ABAP run-time system fields

System Variables are filled by the ABAP run-time environment and can be used in an ABAP program to query system statuses in run-time.

NameTypeLengthContent
sy-abcdec26Contains the Latin alphabet. Can be used to access individual letters directly by specifying the offset/length, regardless of the code page.
sy-batchc1"X" in an ABAP program running in the background; otherwise initial.
sy-binptc1"X" when processing batch input sessions and in ABAP programs called by CALL TRANSACTION USING; otherwise initial. These defaults can be overridden using the addition OPTIONS FROM of the statement CALL TRANSACTION ... USING.
sy-calldc1A blank in the first program of a call sequence; otherwise "X". Set to "X" after calls using CALL TRANSACTION, CALL DIALOG, or SUBMIT ... AND RETURN. Empty if the program was started using LEAVE TO TRANSACTION or by a transaction code entered on the screen. A call using SUBMIT (without AND RETURN) takes the value of the calling program.
sy-callrc8When spooling lists, contains a value that indicates where spooling was started, for example NEW-PAGE for program-driven spooling or RSDBRUNT for spooling from the selection screen.
sy-colnoi-Current position when a list is created in the list buffer; set whenever an output statement is used. Counting begins at 1. This position corresponding to the column in the displayed list is only guaranteed for the lower and upper output limits, since a single character may occupy more columns in the list than positions in the list buffer. See also Lists - System Fields.
sy-cpagei-Page number of the top page in the list display where a list event was raised. Counting begins at 1. See also Lists - System Fields.
sy-cprogc40In externally called procedures, the name of the calling program; otherwise the name of the current program. If an externally called procedure calls another external procedure, sy-cprog contains the name of the master program, and is not set to the name of the master program of the subsequent calling program.
sy-cucoli-Horizontal cursor position on the screen of a dynpro. Counting begins at column 2. Set after the event PAI.
sy-curowi-Vertical cursor position on the screen of a dynpro. Counting begins at row 1. Set after the event PAI.
sy-datarc1Contains "X" for PAI, if at least one input field of a screen was changed by a user or some other data being passed.
sy-datlod-User date, such as "19990723". See System Fields for Date and Time.
sy-datumd-System date. See System Fields for Date and Time.
sy-daystc1"X" in summer time in the system time zone; otherwise initial. See System Fields for Date and Time.
sy-dbcnti-SQL statements set the content of sy-dbcnt to the number of table rows processed.
sy-dbnamc20For executable programs, the associated logical database.
sy-dbsysc10Central database system, for example "HDB" or "ADABAS". See also CL_DB_SYS.
sy-dyngrc4Screen group of the current dynpro. In Screen Painter, multiple dynpros can be assigned to the same screen group, which can be used, for example, to make modifications to all screens in the group at once.
sy-dynnrc4Number of the current dynpro. In selection screen processing, the current selection screen. In list processing, the number of the subscreen dynpro. When processing a subscreen dynpro (including in tabstrips), the number of this dynpro.
sy-fdaywb-Factory calendar weekday in the system time zone; Monday = 1, ..., Friday = 5. See System Fields for Date and Time.
sy-fdposi-Occurrence after certain operations on character-like or byte-like data objects (for example FIND or comparisons).
sy-hostc32Network name of the computer on which the current application server is instantiated, for example "KSAP0001" or "HS01234".
sy-indexi-Loop index. In DO and WHILE loops, contains the number of previous loop passes, including the current pass.
sy-languc1Single-character language key, for example "E", "D", "F", for the current text environment. Set by the logon language of the user or by the statement SET LOCALE.
sy-ldbpgc40In executable programs, the database program of the associated logical database.
sy-lillii-List line on which a list event was raised. Counting begins at 1 and includes the page header. See also Lists - System Fields.
sy-lincti-Page length of the current list when the list is created. sy-linct is 0 for a standard list of any length and has a value not equal to 0 for lists with fixed page lengths. Set by the introductory program statement or by SUBMIT. See also Lists - System Fields.
sy-linnoi-Current list line when the list is created. Counting begins at 1 and includes the page header. Set by output statements. See also Lists - System Fields.
sy-linszi-Row width of the current list in the list buffer when the list is created. By default, the value is set as follows: If sy-scols is greater than or equal to 84, sy-linsz is equal to sy-scols; otherwise sy-linsz has the value 84. This can be overridden by the introductory program statement or by SUBMIT. See also Lists - System Fields.
sy-liselc255Content of the list line in the list buffer where the cursor was placed in the displayed list when a list event was raised (limited to the first 255 characters). See also Lists - System Fields.
sy-listii-List level of the list in which a list event was raised.
sy-loopci-Number of currently displayed rows in a table control. Set after the event PAI.
sy-lsindi-List level of the list that is currently being created (basic list: 0, details lists: greater than 0). For every interactive list event, sy-lsind is automatically increased by an increment of 1. sy-lsind can be changed in ABAP programs when navigating between details lists. Any changes made to sy-lsind are ignored until the end of a list event. See also Lists - System Fields.
sy-macoli-Number of columns on the left margin when spooling lists. Set by the statement SET MARGIN.
sy-mandtc3Client ID used by the current user to log on, for example "401" or "800".
sy-marowi-Number of rows on the top margin when spooling lists. Set by the statement SET MARGIN.
sy-modnoi-Indexing of the ABAP sessions. Contains the value 0 in the first session. In new sessions that are opened using the Create Session function or by calling a transaction with /o in the command field of the standard toolbar, this value is increased by 1. If previous sessions were deleted, only the free numbers are allocated again. Sessions opened with CALL FUNCTION ... STARTING NEW TASK start at 0 again.
sy-msgidc20After the statement MESSAGE, contains the message class. Also set in the calling program after MESSAGE ... RAISING, if it handles the exception (the same applies to RFC exceptions).
sy-msgnon3After the statement MESSAGE, contains the message number. Also set in the calling program after MESSAGE ... RAISING, if it handles the exception (the same applies to RFC exceptions).
sy-msgtyc1After the statement MESSAGE, contains the message type. Also set in the calling program after MESSAGE ... RAISING, if it handles the exception (the same applies to RFC exceptions).
sy-msgv1, sy-msgv2, sy-msgv3, sy-msgv4c50After the statement MESSAGE, contain the field content used for the placeholders of the message. Also set in the calling program after MESSAGE ... RAISING, if it handles the exception (the same applies to RFC exceptions). If a database lock is requested using an ENQUEUE function module, sym-sgv1 contains the name of the user holding the lock after the exception FOREIGN_LOCK.
sy-opsysc10Operating system of the current application server, for example "SOLARIS" or "HP-UX".
sy-pagnoi-Current page when the list is created. Set by output statements. See also Lists - System Fields.
sy-pfkeyc20GUI status of the current dynpro. Set after the event PAI.
sy-repidc40Name of the current ABAP program In procedures called externally, the name of the master program of the procedure. If sy-repid is passed to an external procedure as an actual parameter, the formal parameter is set to the name of the caller.
sy-saprlc4AS ABAP release, for example "702" or "740".
sy-scolsi-Number of columns in the current screen layout. Set after the event PAI.
sy-slsetc14Variant used to fill a selection screen. The associated program name can be seen in sy-cprog.
sy-sponon10Contains the name of the spool number when spooling lists.
sy-srowsi-Number of rows in the current screen layout. Set after the event PAI.
sy-stacoi-Number of the first displayed column of the list in which a list event was raised. Counting begins at 1. See also Lists - System Fields.
sy-staroi-Number of the top displayed list line of the top displayed page of the list where a list event was raised. Counting begins at 1 and does not include the page header. See also Lists - System Fields.
sy-stepli-Index of the current row in a table control. This is set for every loop pass. Outside of a loop, for example after the event POV or POH for a table row, the content of sy-stepl is undefined.
sy-subrci-Return code set by many ABAP statements. In general, the value 0 means that the statement was executed with no problems. Depending on which statement set sy-subrc, the cause of an error can be derived from this value. sy-subrc keeps its previous value or its content is undefined after statements where the setting of sy-subrc is not documented explicitly.
sy-sysidc8Name of AS ABAP, for example "S01" or "K99".
sy-tabixi-Row number in the table index of an internal table. Contains the last row accessed using a primary or secondary table index. Is set to 0 when accessed using a hash algorithm.
sy-tcodec20Name of the current transaction code. Initial in background processing, unless a transaction was called during background processing.
sy-tfilli-In the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, sy-tfill is given the number of rows of the accessed internal table.
sy-timlot-User time, such as "152557". See System Fields for Date and Time.
sy-titlec70Text that appears in the title bar of the dynpro.
sy-tlengi-In the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, sy-tleng is given the row size of the accessed internal table.
sy-tvar0, sy-tvar1, sy-tvar2, sy-tvar3, sy-tvar4, sy-tvar5, sy-tvar6, sy-tvar7, sy-tvar8, sy-tvar9c20Values can be assigned to these system fields in the program. In the event TOP-OF-PAGE, the content of sy-tvar0 through sy-tvar9 replaces the placeholders "&0" through "&9" in the list headers and column headers of the text elements of the program.
sy-tzonei-Time difference of the system time to the UTC reference time in seconds, for example "3600" or "10800". See System Fields for Date and Time.
sy-ucommc70Function code that raised the event PAI. This function code is usually has a unique association with a function. Only Enter can pass assorted function codes to sy-ucomm in accordance with the following hierarchy: Content of the command field in the system toolbar, then associated function code; the content is not affected.
sy-ulinec255Contains 255 "-" characters for displaying lines in lists. In the case of displaying sy-uline with the statement WRITE, the same applies as for the statement ULINE. In other words, every "-" character is replaced by a line element.
sy-unamec12Logon name of the user, for example "KELLERH". See also User-Specific Program Flow.
sy-uzeitt-System time. See System Fields for Date and Time.
sy-vlinec1Contains a vertical bar (|) for displays in lists.
sy-wtitlc1Set to "N" in the statements REPORT, PROGRAM, and FUNCTION-POOL, if the addition NO STANDARD PAGE HEADING is used; otherwise initial. The statement NEW-PAGE does not set sy-wtitl.
sy-zonloc6User time zone, for example "CET" or "PST". See System Fields for Date and Time.

Tutorial Comments

Total Comments: Add your Comment

Leave a Comment

Enter Comment Text