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 in smartforms

former_member203806
Participant
0 Likes
2,438

Hi All

Im going to do smartform, I have two internal tables,

Header internal table -  IT_HEAD ( MBLNR key )

Detail Table - IT_DET ( MBLNR , etc...  )

i want to print MBLNR as header , and want to print detail data , relavent to same MBLNR,

and also print different MBLNR different pages.

Im going to loop header data in LOOP node and under that i have TABLE, in that table im looping my detail TABLE,

But it is not working properly, can u pls explain this......

rgds

pramod

1 ACCEPTED SOLUTION
Read only

thangam_perumal
Contributor
0 Likes
1,374

Hi Pramod,

                you can achieve your requirements wih help of  one loop statement,one table loop and page break.

please collect the different mblnr in new internal table with help of collect statement.

Please Refer below screenshots .

please let me know further facing the prob..

Regards,

Thangam.P

4 REPLIES 4
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,374

You will need nested table. One for header and other for item. After the item loop you need to put command page break so that each document is printed on a new page

Read only

Former Member
0 Likes
1,374

Hi Pramod,

If i understand your reuirement correctly then it is to display material document number along some other deatils as a header and item level deatils on a smartform with page-break on MBLNR field.

I would suggest you the below approach :

Main: this will be the one main table which will store the header and item level data for a particular mblnr.

structure of main table:

Header : contains header details

Item[] : contains item details

Sort the main table based on mblnr first.

Steps :

1.Now loop through main table .

2.Display your header details

3.Loop your item table and dispaly its details.

4.At the end of main loop provide the command to page break .

regards,

Sumit


Read only

thangam_perumal
Contributor
0 Likes
1,375

Hi Pramod,

                you can achieve your requirements wih help of  one loop statement,one table loop and page break.

please collect the different mblnr in new internal table with help of collect statement.

Please Refer below screenshots .

please let me know further facing the prob..

Regards,

Thangam.P

Read only

0 Likes
1,374

HI Thangam

Thank you very much, very help full answer,i got good idea from u r screen shoots,

Thnks.

pramod