Ansicht
Dokumentation
ABENLOOP_AT_ITAB_STEP_ABEXA - LOOP AT ITAB STEP ABEXA
rdisp/max_wprun_time - Maximum work process run time Vendor Master (General Section)This documentation is copyright by SAP AG.
- Loop with Step Size
The example demonstrates the execution of the statement LOOP AT itab with different STEP additions.
Source Code
Description
The table itab is a hashed table with a unique key and a non-unique sorted key. Using STEP additions, the step size and the direction of a loop can be defined. The first table output displays the values for the hashed table in the order in which the table is filled.
- The LOOP is performed without a key specification and without a step size. The table output is in the order in which the table is filled and with the sy-tabix of 0. Each table line is read because the step size is automatically interpreted as 1.
- The LOOP is performed without a key specification and with the step size of -1. The table output is in the reverse order in which the table is filled and with the sy-tabix of 0.
- The LOOP is performed without a key specification and with the step size of 2. The table output is in the order in which the table is filled and with the sy-tabix of 0. Every second table line is read, starting with the first table line.
- The LOOP is performed without a key specification and with the step size of -2. The table output is in the reverse order in which the table is filled and with the sy-tabix of 0. Every second table line is read, starting with the last table line.
- The LOOP is performed with the sorted key sec_key and without a step size. The table output is in a sorted order from the lowest to the highest number and with the value of sy-tabix displaying the number of the respective table line in the secondary table index of sec_key. Each table line is read because the step size is automatically interpreted as 1.
- The LOOP is performed with the sorted key sec_key and with the step size of -1. The table output is in a reverse sorted order from the highest to the lowest number and with the value of sy-tabix displaying the number of the respective table line in the secondary table index of sec_key.
- The LOOP is performed with the sorted key sec_key and with the step size of 2. The table output is in a sorted order from the lowest to the highest number and with the value of sy-tabix displaying the number of the respective table line in the secondary table index of sec_key. Every second table line is read, starting with the first table line.
- The LOOP is performed with the sorted key sec_key and with the step size of -2. The table output is in a reverse sorted order from the highest to the lowest number and with the value of sy-tabix displaying the number of the respective table line in the secondary table index of sec_key. Every second table line is read, starting with the last table line.
- The LOOP is performed with the sorted key sec_key, with the step size of 1, and with the addition of FROM 1 TO 3. The table output is in a sorted order from table line 1 to 3 and with the value of sy-tabix displaying the number of the respective table line in the secondary table index of sec_key. Each table line is read, starting with the first table line.
- The LOOP is performed with the sorted key sec_key, with the step size of -1, and with the addition of FROM 3 TO 1. The table output is in a reverse sorted order from table line 1 to 3 and with the value of sy-tabix displaying the number of the respective table line in the secondary table index of sec_key. Each table line is read, starting with the last table line.
See also the executable example for the FOR expression using the addition STEP.
RFUMSV00 - Advance Return for Tax on Sales/Purchases General Material Data
This documentation is copyright by SAP AG.
Length: 4188 Date: 20240329 Time: 165021 sap01-206 ( 107 ms )