Ansicht
Dokumentation

ABENSYST_FIELD_ACCESS_GUIDL - SYST FIELD ACCESS GUIDL

ABENSYST_FIELD_ACCESS_GUIDL - SYST FIELD ACCESS GUIDL

PERFORM Short Reference   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

Access

The system fields are supplied with values by the ABAP runtime framework. In a program, however, they behave like normal variables. You can assign values to these fields using the ABAP program. This is because both the ABAP kernel and the ABAP components of the ABAP runtime framework have can perform writes on system fields.

Do not write to system fields

In application programs, only perform reads on system fields and never perform writes.

The values of system fields are usually vital for correct program execution. This means performing writes on system fields carries a lot of risk. Write operations in system fields can lead to a loss of important information, which can prevent programs from running correctly. Therefore, you cannot overwrite system fields to change the execution of the program or use the fields to replace explicitly defined variables.

In addition, you cannot misuse system fields as implicit output parameters of procedures, irrespective of whether the fields have been explicitly set within the procedure (due to an illegal write or as the result of an executed statement).

Exception

The only system fields where it was allowed to change the field content (in an application program) are part of classic list processing. This should no longer be used.

The following source code shows a write performed on the system field sy-subrc, which occurs frequently. This write is not harmful but it also is not beneficial: sy-subrc is always set to zero when a function module is called and only adopts a different value by handling a classic exception. Therefore, the statement is redundant.

sy-subrc = 4.
CALL FUNCTION ...
   ...
   EXCEPTIONS ...
CASE sy-subrc.
   ...

The source code below omits the write shown above.

CALL FUNCTION...
   ...
   EXCEPTIONS ...
CASE sy-subrc.
   ...






General Data in Customer Master   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 2271 Date: 20240426 Time: 055037     sap01-206 ( 55 ms )