Ansicht
Dokumentation

ABENFOR_IN_ITAB - FOR IN ITAB

ABENFOR_IN_ITAB - FOR IN ITAB

rdisp/max_wprun_time - Maximum work process run time   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

FOR ... IN itab

... FOR wa$|<fs> IN itab $[INDEX INTO idx$] $[cond$] $[let_exp$]  ...

Addition:

... INDEX INTO idx

Effect

This variant of an iteration expression for table iterations using FOR evaluates an internal table itab sequentially, like a line variant of a LOOP. itab is a functional operand position. As in LOOP, the order of the lines read depends on the table category or a key specified in cond.

cond1 can be used to set conditions for the evaluation. For each read line, the result is either assigned to a local work area wa1 or to a field symbol <fs>. The work area or the field symbol is declared implicitly with the line type of the internal table and bound locally to the FOR expression as a subexpression of the entire constructor expression. The same applies to the namespace and visibility as to the helper 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.

Notes

  • Instead of using directly specified internal tables itab, this variant of FOR expressions can also be created using mesh paths, where FOR expressions from both categories can be used together in the same constructor expression.
  • Changes to the content of the internal table specified after IN within the FOR expression can only be made using method calls. Deleting or replacing the table completely always produces a runtime error.

Example

Construction of an internal table flights in a table iteration with FOR with the value operator VALUE (table comprehension). The lines of the internal table are merged from the content of two existing internal tables scarr_tab and spfli_tab.

Addition

... INDEX INTO idx

Effect

For each read line of the associated FOR expression, this addition sets the helper variable idx to the value to which the system field sy-tabix would be set in a corresponding LOOP. The helper variable idx is declared implicitly with the type i and bound locally to the FOR expression as a subexpression of the entire constructor expression. The same applies to the namespace and visibility as to the helper fields declared in LET expressions.

Example

Construction of an internal table carriers from an existing internal table scarr_tab. The first column is provided with the line index of the existing table.






PERFORM Short Reference   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 4763 Date: 20240329 Time: 020906     sap01-206 ( 90 ms )