SAP NetWeaver AS ABAP Release 750, ©Copyright 2016 SAP AG. All rights reserved.ABAP - Keyword Documentation → ABAP - Reference → Processing Internal Data → Internal Tables → Expressions and Functions for Internal Tables → FOR - Table Iterations →
FOR ... IN itab
... FOR wa|<fs> IN itab [INDEX INTO idx] [
cond] [let_exp] ...
This variant of an iteration expression for table iterations using FOR evaluates an internal table itab sequentially, like a row variant of a LOOP. itab is a functional operand position. As in LOOP, the order of the rows read is determined by the table category or a key specified in cond.
cond1, cond2, ... can be used to set conditions for the evaluation. For each read row, the result is either assigned to a local work area wa1, wa2, ... or to a field symbol <fs1>, <fs2>, ... The work area or the field symbol is declared implicitly with the row type of the internal table and bound locally to the FOR expression as a subexpression of the full constructor expression. The same applies to the namespace and visibility as to the auxiliary fields declared in LET expressions. After the FOR expression, the work area or the field symbol can either be used in further subexpressions or to construct the result of a table comprehension or table reduction.
... INDEX INTO idx
For each row of the associated FOR expression, this addition sets the auxiliary variable idx to the value to which the system field sy-tabix would be set in a corresponding LOOP. The auxiliary variable idx is declared implicitly with the type i and bound locally to the FOR expression as a subexpression of the full constructor expression. The same applies to the namespace and visibility as to the auxiliary fields declared in LET expressions.