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

two loops for table control

Former Member
0 Likes
1,021

hi friends,

why we should use loop statements both in PBO and PAI events for table control in module pool program.

regards,

malleswari.

3 REPLIES 3
Read only

anversha_s
Active Contributor
0 Likes
596

hi,

kindly chk this.

PROCESS BEFORE OUTPUT.
MODULE status_9010.

LOOP WITH CONTROL tab_control.
"* This is to move the data from the internal table to the table control
MODULE move_data_to_table.
ENDLOOP.


PROCESS AFTER INPUT.

LOOP WITH CONTROL tab_control.
"To move the data from the table control to internal table
MODULE move_data_from_table.
ENDLOOP.

Rgds

anver

Read only

Former Member
0 Likes
596

Hi Malleshwari,

We need the loop..endloop in both the PBO & PAI events of your screen because the LOOP statement causes the screen fields to be copied back and forth between the ABAP program and the screen field. For this reason, at least an empty LOOP...ENDLOOP must be there.

For more details on this, go to the documentation provided by SAP as under:

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm">http://help.sap.com/saphelp_47x200/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm</a>

Regards,

Chetan.

PS: Reward points if this is helpful.

Read only

Former Member
0 Likes
596

Hello Malleswari,

The loop..endloop in the PBO is to populate the value into the table control from the program (internal table). The loop...endloop in the PAI is to copy the changes that have been made in the table control on the screen back into the internal table. It is anticipated that some data is passed from the program to the table control and some data is passed back as well. That is why when you dont specify the loop..endloop in PBO/PAI you get an error. This also explains why we write a dummy loop..endloop in PAI in some cases.

Manoj