Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding step loops.

Former Member
0 Likes
615

Hi all,

I am working in step loops , so I want to show Vbap details in steploop when i enter some VBAK input data and press enter button, it should show me the data.

so when i am trying to do the above i m getting error as

THE field "vbap-posnr " is not assigned to a loop . " LOOP -


ENDLOOP"

must appear in "PBO" and PAI.

thanks,

satish

1 REPLY 1
Read only

Former Member
0 Likes
396

Hi Satish,

Check the below example and documentation u will find the answer in that only.

Refer to this program <b>DEMO_DYNPRO_STEP_LOOP</b>

STEP LOOP

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.

STEP LOOP Coding

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.

1) LOOP

MODULE fill_data

ENDLOOP.

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]

ENDLOOP.

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.

NOTE:

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.

Check this SAP help document for step loops.

http://help.sap.com/saphelp_nw04/helpdata/en/d1/801c13454211d189710000e8322d00/content.htm

see this link for more help.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbacac35c111d1829f0000e829fbfe/content.htm

see this code.

PROGRAM ZBHSTEPLOOP.

DATA:OKCODE1 LIKE SY-UCOMM,

OKCODE2 LIKE SY-UCOMM.

TABLES:LFA1,EKKO.

*DATA LIFNR LIKE LFA1-LIFNR.

DATA:BEGIN OF ITAB OCCURS 0,

MANDT LIKE EKKO-MANDT,

EBELN LIKE EKKO-EBELN,

ERNAM LIKE EKKO-ERNAM,

END OF ITAB.

DATA TOPLINE TYPE I VALUE 1.

MODULE USER_COMMAND_1000 INPUT.

CASE OKCODE1.

WHEN 'BACK'.

SET SCREEN 0.

WHEN 'NEXT'.

SET SCREEN 1001.

SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE

LIFNR = LFA1-LIFNR.

ENDCASE.

ENDMODULE. " USER_COMMAND_1000 INPUT

MODULE

USER_COMMAND_1001 INPUT.

CASE OKCODE2.

WHEN 'BACK'.

SET SCREEN 1000.

ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT

MODULE STATUS_1000 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

SET TITLEBAR 'TIT1'.

ENDMODULE. " STATUS_1000 OUTPUT

MODULE STATUS_1001 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

SET TITLEBAR 'TIT2'.

ENDMODULE. " STATUS_1001 OUTPUT

MODULE MOVE_DATA OUTPUT.

EKKO-MANDT = ITAB-MANDT.

EKKO-EBELN = ITAB-EBELN.

EKKO-ERNAM = ITAB-ERNAM.

ENDMODULE. " MOVE_DATA OUTPUT

FLOW LOGIC:

PROCESS BEFORE OUTPUT.

MODULE STATUS_1000.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1000.

PROCESS BEFORE OUTPUT.

MODULE STATUS_1001.

LOOP AT ITAB CURSOR TOPLINE.

MODULE MOVE_DATA.

ENDLOOP.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1001.

LOOP AT ITAB.

ENDLOOP.

<b>please reward if useful</b>

Regards,

sunil kairam.