ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Meshes → Meshes - Using Mesh Paths
LOOP AT mesh_path
7.31 | 7.40 | 7.54
LOOP AT mesh_path result.
Reads all rows described by the results of a mesh
mesh_path in a loop. Essentially,
the loop works like the statement LOOP
AT itab across a directly specified table, but reads the rows of the last path node described
by the mesh path instead. The output behavior
result is specified in exactly the same way as in
LOOP AT itab
and must match the row type of the last path node. The system fields are set in the same way as in the
LOOP AT itab, where
sy-tabix depends on the table key used.
An additional condition can be specified in the square brackets [ ...
] of each association using the additions
USING KEY and
The order in which the rows of the last path node are read is determined by the order in which the rows were found when the mesh path was evaluated. Here, an iteration is performed across every follow-on node in the mesh path, in accordance with the table key used.
If only the initial association is specified, the same rules apply when changing the last path node
in the loop as when using
LOOP AT itab. If a path extension is specified, the following additional restrictions apply:
- No row can be deleted from the last path node.
- No row can be inserted in the last path node (unless a hash key is used).
- No component of the table key being used can be changed.
The full internal table cannot be replaced or deleted in the loop. Mesh nodes evaluated when path extensions are used before the last path node, however, can be modified as required.
- A loop across a mesh path can be understood as a nesting of loops
LOOP AT itabacross the matching follow-on nodes, whose
WHEREconditions are constructed from
ONconditions and the explicitly specified additional conditions. The evaluation itself, however, does not take place in nested
LOOPs and multiple iterations across a single table row never take place.
- If path extensions are used, any rows found more than once in mesh path evaluations are iterated only once each.
- Tables located before the last path node in path extensions can be modified in any way in the loop, since they are evaluated only once before the loop is executed across the last path node.