SAP USE OPERAND POSITION - Guide
Get Example source ABAP code based on a different SAP table
GUIDELINE 6.29
Using Elements in Operand Positions
ABAP_BACKGROUND
Statements that modify the content of system fields generally evaulate the operands first and then set the system fields. In some complex statements, however, a system field could be set first, before all operand positions are evaluated.
ABAP_RULE
For reasons of robustness, do not use system fields as operands of statements that themselves set these system fields.
ABAP_DETAILS
A program does not always define whether a particular system field is set in a statement before or after an operand is evaluated. This means that, to reduce risks and to make the program easier to read, the content of a system field should always be copied to an auxiliary variable and only this copy should be used within the statement in question.
Note
Also take note of how functional methods are used in operand positions. These methods also modify important system fields. Also be careful here when using system fields in operand positions of the same statement.
Bad example
The following source code shows how the system field
...
READ TABLE itab2 ... • sy-tabix.
...
ENDLOOP.
Good example
The following source code makes the example above more robust by assigning the value of the system field
index = sy-tabix.
...
.... itab2[ index ] ...
...
ENDLOOP.