Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Meshes →  Meshes - Using Mesh Paths 

LOOP AT mesh_path

Other versions: 7.31 | 7.40 | 7.54

Syntax


LOOP AT mesh_path result. 
  ...
ENDLOOP.

Effect

Reads all rows described by the results of a mesh path 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 statement LOOP AT itab, where sy-tabix depends on the table key used.

An additional condition can be specified in the square brackets [ ... ] of each mesh association using the additions USING KEY and WHERE log_exp.

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 mesh 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.


Notes

  • A loop across a mesh path can be understood as a nesting of loops LOOP AT itab across the matching follow-on nodes, whose WHERE conditions are constructed from ON conditions 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.

Executable Example

Loops Across Mesh Paths

Continue

Loops Across Mesh Paths