Application Development 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: 

Loop within loop in smartforms

Former Member
0 Kudos

Hi Guys,

I have a case where i get Sales order no. For each line item there are multiple schedule  line items.

The Smart form has to print in table a line item & under it all the schedule line item.

Then the other block will print second line item and then under it multiple schedule line item.

I have driver program which gives me multiple line items & multiple schedule line item in internal table.

For sch line items, i have first column as Line item.

What i have done is SF, is under main window, i have created a loop and check the flag for internal table and put all line item in internal table

under this loop i have created another loop which will loop the sch line item based on where condition of line item.

When i print, i see all line items coming in one go and then under line item comes the sch line items multiple time.

How can i used loop within tin loop to print the

SO ( one time)

   Line item ( 1st)

      Sch line item ( 1)

      Sch line item (2)

  

   Line item ( 2nd)

      Sch line item ( 1)

      Sch line item (2)

Please advice.

2 REPLIES 2

Former Member
0 Kudos

In the main Window create a table to print sales order then you can use two folders inside main area of the table and use that to print line item and sch line items.

Table Loop sales order table

     Main Area

        Sales Order first line

          Folder1

               loop line item table

                   line item print first line

                        folder2

                             loop sch line table

                                   sch line first line

                                   sch line Second line

This logic is a bit complex but hope it helps.

former_member218424
Participant
0 Kudos

Hi,

1) First create a folder the group all things together

2) Create header for that folder and give sales order number as you want to print it once.

3) Create Main loop to print sales order item where sales order no. = sales order no., use text to print sales order item

4) Create Nested loop inside Main loop using sales order item in where clause, use text to print sch line item..

Below is screen shot :-