cancel
Showing results for 
Search instead for 
Did you mean: 

Loop in Smartforms

Former Member
0 Kudos

Hi Gurus,

I am passing a 2 tables in SMARTFORMS namely, table1 and table2. I loop on table1 and again issue another loop in table2 to filter the key fields coming from table1. Here is my problem, on the 1st record on table1, upon filtering table2, it displays 5 lines (assuming that table2 after filtering has 5 records). On the 2nd record on table1, again upon filtering table2, it only has 2 lines. But upon displaying the record, Smartforms diplays 5 lines also but 2 lines are with data. How can I eliminate the extra lines or how can I display the current number of records in Smartformns?

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

You have to send the whole data through single table by putting the checks in your source code using nested loop.

e,g

loop at itab1.

itab3-sno = sy-tabix.

itab3-data1 = itab1-data1

itab3-data2 = itab1-data2

append itab3.

loop at itab2 where data1 = itab1-data1.

  • as per ur requirment

itab3-data3 = itab2-data3.

itab3 -data4 = i tab2 -data4.

itab3 -data5 = itab2 -data5.

append itab3.

endloop.

endloop.

if your 2nd table has different header u can use 2nd row FOR header u can use sno = 1 in your condition after every text in the 2nd row it will print only once and after that u have to use the third row for your second table data. .

i hope this will solve your problem.

Regards,

Zahid hameed.

Edited by: ZAHID HAMEED on Jul 17, 2010 7:01 PM

Former Member
0 Kudos

Hi ,

Please add where condition in table 2 and use text element to display the current record from the table 2 work area.

Thanks,

Kedar