ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Internal Tables → Processing Statements for Internal Tables → LOOP AT itab
LOOP AT itab - result
Other versions: 7.31 | 7.40 | 7.54
Syntax
... { INTO wa }
| { ASSIGNING <fs> [CASTING] }
| { REFERENCE INTO dref }
| { TRANSPORTING NO FIELDS } ... .
Effect
There are four alternatives for output behavior:
-
With the
INTO
addition, you assign the content of the current row to awa
work area. -
With the
ASSIGNING
addition, you assign the current row to a field symbol<fs>
; within the loop, you are not allowed to assign a different memory area to the field symbol or cancel the assignment withUNASSIGN
. -
With the
REFERENCE INTO
addition, you set a reference to the current row in a reference variable. Within the loop, you are not allowed to assign another reference to the reference variable, and you are not allowed to initialize the reference variable withCLEAR
. -
With the
TRANSPORTING NO FIELDS
addition, you only maintain the corresponding system fields. This addition is only possible if theWHERE
addition is used simultaneously in thecond
conditions.
With the exception that no further
transport_options can be specified after INTO wa
, the syntax and
meaning of the specification of the output behavior are the same as in the
READ TABLE
statement. The same restrictions apply regarding the modification of key fields of the
primary and
secondary table keys.
Notes
Aside from classes, there is one other obsolete short
form for LOOP
for which you can omit the INTO wa
specification if the internal table has an itab
header line of the same name. The statement is supplemented with INTO itab
.
-
If the current row is deleted within the loop during the use of additions
ASSIGNING
orREFERENCE INTO
, the field symbol or reference variable is then not assigned in the current loop pass or remains unbound.