ABAP Keyword Documentation → ABAP − Short Reference
LOOP AT itab - Short Reference
Other versions: 7.31 | 7.40 | 7.54
Syntax
LOOP AT itab { { INTO wa } 
             | { ASSIGNING <fs> [CASTING] } 
             | { REFERENCE INTO dref } 
             | { TRANSPORTING NO FIELDS } } 
             [USING KEY key_name|(name)] 
             [ FROM idx1] [TO idx2] [WHERE log_exp|(cond_syntax) ] 
             [ GROUP BY key | ( key1 = dobj1 key2 = dobj2 ... 
                 
              [gs = GROUP SIZE] [gi = GROUP INDEX] ) 
                 [ASCENDING|DESCENDING [AS TEXT]] 
                 [WITHOUT MEMBERS] 
                [ {INTO group} 
                | {ASSIGNING <group>} 
                | {REFERENCE INTO group_ref} ] ]. 
  ... 
ENDLOOP. 
Effect
Reads an internal table itab in a loop. A restricted
variant works withmesh paths.  
Additions
- 
INTO wa
Assigns the row (read from internal table) to a work areawa. - 
ASSIGNING <fs> [CASTING]
Assigns the row (read from internal table) to a field symbol<fs>, where casting can be performed. - 
REFERENCE INTO dref
Assigns a reference to the row (read from internal table) to a reference variabledref. - 
TRANSPORTING NO FIELDS
Row (read from internal table) is not assigned. - 
USING KEY key_name|(name)
Statically or dynamically specifies a (secondary) table key that determines the processing order. - 
[FROM idx1] [TO idx2] [WHERE log_exp|(cond_syntax)]
Restricts the rows to be read, by declaring a lower number and upper number (idx1andidx2in the relevant table index), or by declaring a static conditionlog_expor a dynamic condition incond_syntax. - 
GROUP BY ...
Groups the rows in the internal table by a group key and executes a loop across the groups.ASCENDING|DESCENDINGsorts the groups;WITHOUT MEMBERSsuppresses the grouping variant for the table rows;INTO GROUP, ASSIGNING, andREFERENCE INTOdefine the output behavior of the group loop.