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

sy-abcde c(26)

Contains the Latin alphabet. Can be used to access individual letters directly by specifying the
offset/length, regardless of the code page.

sy-batch c(1)

Set to "X" in an ABAP program that runs in the background, otherwise initial.

sy-binpt c(1)

Set to "X" during processing of batch input sessions, and in ABAP programs called using
CALL TRANSACTION USING. Otherwise initial.

sy-calld c(1)

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.

sy-callr c(8)

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.

sy-colno i

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.

sy-cpage i

Page number of the page displayed at the top of the list for which a list event was triggered.
Counting begins at 1.

sy-cprog c(40)

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.

sy-cucol i

Horizontal cursor position in the display on a screen. Counting begins at column 2.

sy-curow i

Vertical cursor position on the screen display of a screen. Counting begins at line 1.

sy-datar c(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-datlo d

Local date of the user - for example, "19990723". Can be set using GET TIME.

sy-datum d

Local date of the ABAP system. Can be set using GET TIME.

sy-dayst c(1)

"X" during summertime, otherwise initial.

sy-dbcnt i

SQL statements set the content of sy-dbcnt to the number of processed table lines.

sy-dbnam c(20)

In executable programs, the linked logical database.

sy-dbsys c(10)

Central database system - for example, "ORACLE", "INFORMIX".

sy-dyngr c(4)

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.

sy-dynnr c(4)

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.

sy-fdayw b

Factory calendar weekday, Monday = 1, ..., Friday = 5.

sy-fdpos i

Found location for search in byte-type and character-type data objects.

sy-host

Name of the current application server - for example, "KSAP0001", "HS01234".

c(8)

sy-index i

Loop index. In DO and WHILE loops, contains the number of the loop passes including the
current pass.

sy-langu c(1)

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.

sy-ldbpg c(40)

In executable programs, the database program of the linked logical database.

sy-lilli i

List line for which a list event was triggered. Counting begins at 1 and includes the page
header.

sy-linct i

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.

sy-linno i

Current list line during list creation. Counting begins at 1 and includes the page header.

sy-linsz i

Line width of the current list in the list buffer during list creation.

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

List level of the list for which a list event was triggered.

sy-loopc i

Number of lines currently displayed in a table control.

sy-lsind i

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.

sy-macol i

When printing lists, contains the number of columns on the left edge.

sy-mandt c(3)

client identifier with which the user has logged on - for example, "401", "800".

sy-marow i

When printing lists, contains the number of lines on the top margin.

sy-modno i

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.

sy-msgid c(20)

After the statement MESSAGE, contains the message class.

sy-msgno n(3)

After the statement MESSAGE, contains the message number.

sy-msgty c(1)

After the statement MESSAGE, contains the message type.

sy-msgv1
... sy- c(50)
msgv4

After the statement MESSAGE, contain the contents of the fields that were used as
placeholders in the message.

sy-opsys c(10)

Operating system of the current application server - for example, "SOLARIS", "HP-UX".

sy-pagno i

Current page in list creation.

sy-pfkey c(20)

GUI status of the current screen.

sy-prdsn c(6)

When printing lists, contains the name of the spool file.

sy-repid c(40)

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.

sy-saprl c(4)

Release status of the ABAP system - for example, "46D", "610".

sy-scols i

Number of columns of the current screen.

sy-slset c(14)

Variant that was used for filling a selection screen.

sy-spono n(10)

When printing lists, contains the name of the spool number.

sy-srows i

Number of lines of the current screen.

sy-staco i

Number of the first column displayed in the list for which a list event has been triggered.
Counting begins at 1.

sy-staro i

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.

sy-stepl i

Index of the current line in a table control. This is set for every loop pass.

sy-subrc i

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.

sy-sysid c(8)

Name of the ABAP system - for example, "S01", "K99".

sy-tabix i

Table index. Last addressed line of a standard table or sorted table. Is set to 0 if hashed table is
accessed.

sy-tcode c(20)

Name of the current transaction code. Initial in background processing, unless a transation
was called during background processing.

sy-tfill i

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.

sy-timlo t

Local time of the user, for example "152557". Can be set using GET TIME.

sy-title c(70)

Text that appears in the title bar of the screen.

sy-tleng i

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.

sy-tvar0
... sy- c(20)
tvar9

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.

sy-tzone i

Time difference to the UTC reference time in seconds - for example, "3600", "10800".

sy-ucomm c(70)

Function code that triggered the event PAI.

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

User's logon name - for example, "KELLERH".

sy-uzeit t

Local time of the ABAP system. Can be set using GET TIME.

sy-vline c(1)

Contains a vertical line (|) for displaying in lists.

sy-wtitl c(1)

In the statements REPORT, PROGRAM, and FUNCTION-POOL, set to "N" if the addition NO

STANDARD PAGE HEADING is used, otherwise initial.


sy-zonlo c(6)

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