Ansicht
Dokumentation

ABAPLOOP_AT_ITAB_VARIANTS - LOOP AT ITAB VARIANTS

ABAPLOOP_AT_ITAB_VARIANTS - LOOP AT ITAB VARIANTS

CL_GUI_FRONTEND_SERVICES - Frontend Services   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

LOOP AT itab

Short Reference



Loop across table lines

1. LOOP AT itab result $[cond$].
    ...
  ENDLOOP.

Loop across line groups

2. LOOP AT itab result $[ cond$] GROUP BY group_key
                             $[ASCENDING$|DESCENDING $[AS TEXT$]$]
                             $[WITHOUT MEMBERS$]
                             $[group_result$].
    ...
  ENDLOOP.


Effect

Executes a table iteration as a loop across an internal table itab. itab is a functional operand position.

The statements LOOP and ENDLOOP define the statement block of the loop. The statement LOOP reads lines from the internal table itab sequentially that meet an optional condition cond.

  • If the addition GROUP BY is not specified, the statement block is executed for each read line and the line can be processed here. The way in which the read line can be addressed in the statement block is specified in the output behavior result.
  • The addition GROUP BY is used to group the read lines by a group key group_key and the statement block is then executed for each group. The way in which the current group can be addressed in the statement block is specified in the output behavior group_result.

To exit processing of the loop, the following statements can be used:

For changing the internal table within a loop, special rules apply. Especially, you should never do a write access to the complete table body.

Note

Internal tables can also be specified as a data source of a query in .

Example

Simple LOOP over an internal table.






Vendor Master (General Section)   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 4011 Date: 20240623 Time: 204151     sap01-206 ( 48 ms )