You are on page 1of 4

ABAP System Fields

System fields are filled by the ABAP runtime environment and can be used in an ABAP program to query system statuses. With one exception (sy-repid), system fields are variables, but they should only be accessed on a read-only basis. Otherwise, important information for further program execution often gets lost. System fields in ABAP programs can only be overwritten in a few cases to control system behavior. With the exception of sy-repid, the data types of the system fields are defined in the structure SYST in the ABAP Dictionary (as of release 6.10), and are instantiated in ABAP programs as components of the predefined structure sy. The structure sy exists only once in an internal session and is used by all programs of an internal session. The structure sy can also be addressed via syst. There is also a predefined data type sy, which can be used instead of the data type SYST of the ABAP Dictionary. The following table shows the system fields that can be used in ABAP programs. All other components of the structure sy are either intended for internal use by the ABAP runtime environment or are obsolete. Name Type Content Contains the Latin alphabet. Can be used to access individual letters directly by specifying the offset/length, regardless of the code page. Set to "X" in an ABAP program that runs in the background, otherwise initial. Set to "X" during processing of batch input sessions, and in ABAP programs called using CALL TRANSACTION USING. Otherwise initial. Contains a blank character in the first program in a call sequence, otherwise contains the value "X". Is 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 a transaction from the screen. A call using SUBMIT (without AND RETURN) assumes the value of the calling program. When printing lists, contains a value that displays where printing was started - for example, NEW-PAGE for program-controlled printing, or RSDBRUNT for printing from the selection screen. Current position during creation of a list in the list buffer. Counting begins at 1. In nonUnicode systems, this position also corresponds to the column in the displayed list. In Unicode systems, this is only guaranteed for the lower and upper output limits applicable to each output, as one character may take up more columns in the list than positions in the list buffer. Page number of the page displayed at the top of the list for which a list event was triggered. Counting begins at 1. In procedures called externally, the name of the calling program, Otherwise the name of the current program. If a procedure called externally calls another external procedure, sycprog contains the name of the framework program, and is not set to the name of the framework program of the subsequent calling program. Horizontal cursor position in the display on a screen. Counting begins at column 2. Vertical cursor position on the screen display of a screen. Counting begins at line 1. At PAI, contains "X" if at least one input field of a screen has been changed by a user or by further data transfer, otherwise initial.

sy-abcde c(26) sy-batch c(1) sy-binpt c(1)

sy-calld c(1)

sy-callr c(8)

sy-colno i

sy-cpage i

sy-cprog c(40) sy-cucol i sy-curow i sy-datar c(1)

sy-datlo d sy-datum d sy-dayst c(1) sy-dbcnt i sy-dbnam c(20) sy-dbsys c(10) sy-dyngr c(4)

Local date of the user - for example, "19990723". Can be set using GET TIME. Local date of the ABAP system. Can be set using GET TIME. "X" during summertime, otherwise initial. SQL statements set the content of sy-dbcnt to the number of processed table lines. In executable programs, the linked logical database. Central database system - for example, "ORACLE", "INFORMIX". Screen group of the current screen. In the Screen Painter, several screens can be assigned to a common screen group, which can be used, for example, for making modifications to all screens in the group at once. Number of the current screen. During selection screen processing, this is the current selection screen. During list processing, the number of the subscreen container. During processing of a subscreen screen (including in tabstrips), this screen number. Factory calendar weekday, Monday = 1, ..., Friday = 5. Found location for search in byte-type and character-type data objects. Network name of the computer on which the current application server is instantiated - for example, "KSAP0001", "HS01234". Loop index. In DO and WHILE loops, contains the number of the loop passes including the current pass. Single-character language key - for example, "D", "E", "F" - for the current text environment. Set according to the logon language of the user or by using the statement SET LOCALE. In executable programs, the database program of the linked logical database. List line for which a list event was triggered. Counting begins at 1 and includes the page header. Page length of the current list during list creation. sy-linct is 0 for a standard list of any length, and has a value that is not 0 for lists with a defined page length. Current list line during list creation. Counting begins at 1 and includes the page header. Line width of the current list in the list buffer during list creation.

sy-dynnr c(4) sy-fdayw b sy-fdpos i sy-host c(32)

sy-index i sy-langu c(1) sy-ldbpg c(40) sy-lilli i sy-linct i sy-linno i sy-linsz i

sy-lisel c(255) Content of the list line in the list buffer, on which the cursor was positioned while a list event was triggered (restricted to the first 255 lines). sy-listi i sy-loopc i sy-lsind i sy-macol i sy-mandt c(3) sy-marow i sy-modno i sy-msgid c(20) sy-msgno n(3) sy-msgty c(1) List level of the list for which a list event was triggered. Number of lines currently displayed in a table control. 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 only be changed in ABAP programs for navigating between details lists. When printing lists, contains the number of columns on the left edge. client identifier with which the user has logged on - for example, "401", "800". When printing lists, contains the number of lines on the top margin. Indexing of external 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 input field of the standard toolbar, this value is increased by 1. After the statement MESSAGE, contains the message class. After the statement MESSAGE, contains the message number. After the statement MESSAGE, contains the message type.

sy-msgv1 ... sy- c(50) msgv4 sy-opsys c(10) sy-pagno i sy-pfkey c(20) sy-prdsn c(6)

After the statement MESSAGE, contain the contents of the fields that were used as placeholders in the message. Operating system of the current application server - for example, "SOLARIS", "HP-UX". Current page in list creation. GUI status of the current screen. When printing lists, contains the name of the spool file. Name of the current ABAP program. For procedures called externally, name of the framework program of the procedure. sy-repid when transferring actual parameters to an external procedure, before release 6.10, the formal parameter was not set to the name of the caller, but to the name of the procedure instead. As of release 6.10, sy-repid can be transferred to procedures without help fields. Release status of the ABAP system - for example, "46D", "610". Number of columns of the current screen. Variant that was used for filling a selection screen. When printing lists, contains the name of the spool number. Number of lines of the current screen. Number of the first column displayed in the list for which a list event has been triggered. Counting begins at 1. Number of the list line displayed at the top of the page at the top of the list, for which a list event was triggered. Counting begins at 1 and does not include the page header. Index of the current line in a table control. This is set for every loop pass. Return value that is set by many ABAP statements. In general, the value 0 means that the statement was executed with no problems. Depending on which statement was used to set sy-subrc, the cause of any errors can be derived from the corresponding value. Name of the ABAP system - for example, "S01", "K99". Table index. Last addressed line of a standard table or sorted table. Is set to 0 if hashed table is accessed. Name of the current transaction code. Initial in background processing, unless a transation was called during background processing. In the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, sy-tfill is filled with the number of lines in the internal table that has been addressed. Local time of the user, for example "152557". Can be set using GET TIME. Text that appears in the title bar of the screen. In the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, sy-tleng is filled with the line size of the internal table that is being addressed. These system fields can be assigned values in the program. At the event TOP-OF-PAGE, the content of sy-tvar0 to sy-tvar9 replaces the placeholders "&0" to "&9" in the list and column headers of the text elements of the program. Time difference to the UTC reference time in seconds - for example, "3600", "10800". Function code that triggered the event PAI. User's logon name - for example, "KELLERH".

sy-repid c(40)

sy-saprl c(4) sy-scols i sy-slset c(14) sy-spono n(10) sy-srows i sy-staco i sy-staro i sy-stepl i sy-subrc i sy-sysid c(8) sy-tabix i sy-tcode c(20) sy-tfill i sy-timlo t sy-title c(70) sy-tleng i sy-tvar0 ... sy- c(20) tvar9 sy-tzone i sy-ucomm c(70) sy-uname c(12)

sy-uline c(255) Contains a horizontal line of length 255 for displaying in lists.

sy-uzeit t sy-vline c(1) sy-wtitl c(1) sy-zonlo c(6)

Local time of the ABAP system. Can be set using GET TIME. Contains a vertical line (|) for displaying in lists. In the statements REPORT, PROGRAM, and FUNCTION-POOL, set to "N" if the addition NO STANDARD PAGE HEADING is used, otherwise initial. Time zone of the user - for example, "CET", "PST".

The data type and length of the system fields are specified in the second column in the notation type(length). As of release 6.10, the system field sy-repid is no longer a part of the structures SYST or sy. Instead, each program contains the predefined constants sy-repid and syst-repid, which both contain the name of the relevant program. There are also two predefined types with the same names, sy-repid and syst-repid, of type c and length 40. Notes As of Release 7.0, the static methods of the class CL_ABAP_SYST also return important system statuses. There is no possibility of a previous overwriting in the program. If possible, a system field should be evaluated directly following the statement that set it, so that it is not overwritten by other statements. If necessary, store the values of system fields in auxiliary variables. A system field should only be used as an operand at a read position if its content is not set by the same statement. Otherwise, the system may behave unexpectedly. System fields and the corresponding structure SYST have a purely programm-internal significance. No dynpro fields should be created with reference to system fields, since the corresponding field helps are not intended for end users. Internal system fields are intended solely for internal use within the ABAP runtime environment and in the kernel. They must not be overwritten in ABAP programs and should not be read processed either. The obsolete system fields were copied in the transition from R/2 to R/3 and are no longer supplied. These system fields must no longer be used. An extended list of system fields is available in the application help.

You might also like