ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Internal Tables → Processing Statements for Internal Tables
LOOP AT itab
Other versions:
7.31 | 7.40 | 7.54
Syntax Forms
Loop across table rows
1. LOOP AT itab result
[cond]. ...
ENDLOOP.
Loop across row 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 rows 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 row and the row can be processed here. The way in which the read row is addressed in the statement block is specified in the output behaviorresult
. -
The addition
GROUP BY
is used to group the read rows by a group key group_key and the statement block is then executed for every group. The way in which the current group is addressed in the statement block is specified in the output behaviorgroup_result
.
To exit processing of the statement block, the statements described in the leave loops section can be used.