SAP TABLE EXP SIDE EFFECT ABEXA

Get Example source ABAP code based on a different SAP table
  


ARTICLE

Table Expressions, Side Effects
This example demonstrates a possible side effect when field symbols are produced as the result.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
A table expression is used to pass a row of an internal table and the internal table itself to a method. The row in question of the internal table is modified in the method by specifying a table expression on the left side of an assignment.
In the first method call, the table expression is passed by reference without the VALUE operator. The result is a temporary field symbol to which the row in question is assigned throughout the entire method call. The change made to the row in the table also has an effect on the formal parameter.
In the second method call, the table expression is passed by reference with the VALUE operator. The result is a temporary work area that exists throughout the entire method call. The change made to the row in the table does not affect the formal parameter.
The third and fourth method calls repeat the previous calls, but use pass by value instead of pass by reference. Pass by value does not produce any side effects, regardless of the result.
The critical point demonstrated here also produces a syntax check warning in the extended program check (for performance reasons), if not hidden using the pragma ##operator.