Get Example source ABAP code based on a different SAP table
ID WHILE • WHILE ABAP Statement
WHILE> Short Reference >
ABAP_SYNTAX WHILE log_exp>> $[statement_block$]> ENDWHILE.>
What does it do? Conditional loop. The statements WHILE> and ENDWHILE> define a control structure that can contain a complete statement block> statement_block >. After WHILE>, any logical expression> log_exp>> can follow. The statement block is repeated as long as the logical expression is true, or until it is exited with one of the statements to exit loops. In particular, the statement EXIT>> is intended for exiting a loop completely. Within the statement block, the system field sy-index> contains the number of previous loop passes, including the current pass. In nested loops, sy-index> always refers to the current loop.
Latest notes:
If WHILE> loops are used to construct values or fill internal tables, they can usually be expressed more elegantly using conditional iterations with FOR>> in constructor expressions. NON_V5_HINTS
A maximum runtime can be configured using the profile parameters> rdisp/scheduler/prio_low/max_runtime> >, rdisp/scheduler/prio_normal/max_runtime>>, and rdisp/scheduler/prio_high/max_runtime> >. If this runtime is exceeded because the logical expression is never false and the loop is not exited in any other way, the program is terminated by the runtime framework.
The obsolete addition VARY>> can be used to process a sequence of data objects in the memory. ABAP_HINT_END
ABAP_EXAMPLE_VX5 Filling of an internal table with 100 lines. A FOR> > expression can now also be used for that purpose. ABEXA 00765 ABAP_EXAMPLE_END