cancel
Showing results for 
Search instead for 
Did you mean: 

How to do the loop of itab in smartform?

Former Member
0 Kudos

i,

I am generating a smartform for a customer collection report.

I am passing result itab of a report to the smartform, it should display the closing balance of customer in main  window only once

and the itab data should float.

Result itab has 10 records, each record has 10,000/- amount, so in closing balance it should display 1,00,000/-.

But, i m getting 10,000/-  10 times, this i kept in loop. but i m not getting exactly.

 

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

gouravkumar64
Active Contributor
0 Kudos

Paste your screenshot of coding part & where you have loop that part.

Gourav.

Former Member
0 Kudos

Hi, Gourav,

Total coding i have done in print prog and it is displaying proper result.

That result itab i looped in smarform like below,

-main window

  -loop (here loop the it_result)

     -program lines( v_closebal = it_result-balance)

          -text (&v_closebal)

this way i have done.

I am getting

     10000

     10000

     10000

     .

     .

but i want the total in v_closebal

Regards,

Suma

gouravkumar64
Active Contributor
0 Kudos

This message was moderated.

che_eky
Active Contributor
0 Kudos

Smartforms provides standard techniques for handling totals in TABLES or LOOPS. If you are using a LOOP you can use the Calculations tab to calculate totals for contents of the loop. Try something like the following, print the total after the loop has been processed:

Former Member
0 Kudos

      I want that zclosebal as total.

gouravkumar64
Active Contributor
0 Kudos

Hi,

write some thing like this

loop at it_final2 into wa_final2

bcoz internal tbale to work are is possible not internal table to internal tbale,

also define that work are in global definition....

then write

zclosebal = wa_final2-bal.

pass wa_final2 as input param also.

try it.

gourav.

Former Member
0 Kudos

Hi Che,

Still i am getting the same result i.e., one by one.

che_eky
Active Contributor
0 Kudos

From your screen shot it looks like you are printing CUSTOMER COPY for each line in table IT_FINAL2. Is this really what you want? or do you want to print CUSTOMER COPY only once with a total of all lines in IT_FINAL2?