Make your own free website on

SAP PM & ABAP Code Niraj Visnoi

Step Loop in Screen programming in SAP ABAP

What is SAP ?
SAP LSMW Explained with example
SAP PM T-Codes
PM BRD/COR Maintenance
Add Your URL
User Exits & Enhancements
Best Of SAP Links
BDC Code
My Resume
SAP SmartForms Step by Step
SAP ABAP ALV Grid Explained with Example
Useful Tips
Contact Information Guest Book and Consultants List
ABAP System Fields
SAPScript Graphics
SAPScript Print Program
ABAP ListViewer
Dialog Programming
SAP Tables
Recommended SAP ABAP Coding guidelines
SAP General ABAP
Submit Your Code
SAP Books For consultants
Free Website Submission and ROR Sitemap generator
Free Domain Search
Free HoroScope

Step Loop :creation  on screen and ABAP programming.

 The STEP LOOP are the predecessor of TABLE CONTROL they are used to
display tabular data on the screen.They are repeated sequence of blocks of screen element.In a step loop number of screen elements
are combined together to form a loop block.There are 2 types of step loops
1)fFxed Size 2)Variable Size..
 In a fixed size loop the number of loop blocks shown in the screen is fixed,while in case of variable size step loop the number of blocks will change dynamically
according to the size of the screen.There could be only one variable step loop per screen and unlimited fixed size step loops per screen.
 A step loop can extend more than one line on the screen(see Table Control).A vertical scroll bar is automatically created to show step loops on he screen.
 Step loops have no name. We use LOOP ...ENDLOOP to program step loops in a screen in both PBO and PAI.
 Since the number of loop blocks in variable step loops can change the number of loop blocks at any moment is placed by the system in system field SY-LOOPC
and the current step loop pass number is placed in system field SY-STEPL .
Loop Type attribute is used to specify the type of step loop and Loop Count attribute is used to specify the number of step loop blocks that will be displayed on the screen at a time.

Step Loop Screen Creation
 We create step loop in the screen painter(SE51). First we define the screen elements that will be part of the step loop on the screen ,they may extend to more than one line.Select all the elements as one group.Goto Edit menu and select Grouping-->Step Loop-->Define.
 To define a step loop as variable or fixed.goto Edit-->Grouping-->Step Loops-->Fix or Variable.
 To edit the Step Loop click on the border of the block and goto
Edit-->Grouping-->Step Loop here we can use define/undefine(delete)variable fix options.
Once created we have to program step loops through screen key word LOOP...ENDLOOP in PBO and PAI as these events are used to transfer back and forth the data from the ABAP program.

 We use two flavours of LOOP ... ENDLOOP in screen flow logic to  program the step loops.We have to program both in PBO and PAI so that transfer of data can take place between screen and abap program. 
   MODULE fill_data
      here in PBO a module should be called that will transfer the data to the
screen fields. In PAI the module call is not required only the empty LOOP..ENDLOOP will do or we can call a module to write the data to an internal table.In this method there is no automatic scrolling we have to program it in ABAP.
2) LOOP AT int_table [INTO wa ][CURSOR line_number][FROM n1 TO n2]
   Here in PBO a module call is not required to fill the step loop screen fields as the data is copied to the workare wa and from there to screen fields in step loop automatically. INTO wa is not required if we use the int_table declared with a header line. 
  In PAI the addition AT int_table is also required for automatic scrolling.
The parameter CURSOR line_number which is of TYPE I is used to specify
the that will be the first to be displayed,it is filled in the ABAP program.
1) It is preferable to use TABLE CONTROL instead of STEP LOOPS.
2) It is preferable to use LOOP AT int_table instead of plain LOOP..ENDLOOP.

Search Search www      Niraj Visnoi *INDIA *      
 CELL No. 91 9911413767       Copyright 2006 all rights reserved