ARTIClE
Step Loop
This example demonstrates the obsolete direct use of step loops.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
In the layout of screen 100, a variable step loop is defined with 10
repeating groups. The fields of the repeating groups are the components
col1 and col2 of the wa structure of the ABAP
program.
In the status STATUS_100 , the function codes
FIRST_PAGE , PREV_PAGE , PREV_LINE , NEXT_LINE ,
NEXT_PAGE , LAST_PAGE , and NEXT are set on
pushbuttons of the application toolbar for screen 100.
The layout for screen 200 is the same as for screen 100, except that the
step loop here is fixed rather than variable.
In the status STATUS_200 , the function code PREVIOUS is
set on a pushbutton of the application toolbar for screen 200.
During the execution of the program, a step loop is displayed on screen
100 that has a number of lines corresponding to the height of the
screen, but that does not have a scroll bar. On screen 200, a step loop
is displayed which has a fixed size of 10 rows; this loop has a vertical
scroll bar.
During PBO , both loops are filled from the internal table
itab ; the loop on screen 100 is executed using only the step loop,
whereas the loop on screen 200 is executed by the step loop and the
internal table in parallel. The step loop on screen 200 is limited to
rows 5 to 25 of the internal table. To fill the work area wa on
screen 100, a PBO module is called. This is not necessary for
screen 200.
During PAI , a module is called on both screens from within the
loops, in which any user inputs in the step loop rows can be copied to
the corresponding rows of the internal table.
For screen 100, the scroll function for the step loop is programmed in
PAI-Modul user_command_100 . For this purpose, the number
of rows in the step loop on the screen is temporarily stored in the
auxiliary variable step , as sy-loopc is only filled in the
loop. For screen 200, there is no need to program a scroll function as
it is supplied automatically by the system through the scroll bar.
The synchronization between the internal table and the step loop on
screen 200 uses the variable c that is used in the CURSOR
addition of the LOOP statement. Before screen 200 is called,
it is set to the corresponding display of the table on screen 100, so
that the step loops on both screens begin at the same table row. During
the PAI of screen 200, c is read to determine the new
first row of the table after any scrolling with the scroll bar.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved