cancel
Showing results for 
Search instead for 
Did you mean: 

Page Wise Total in Smartform

Former Member
0 Kudos

Hi all,

I have a requirement to print a table, with a total of the rows displayed on that page at the end. I have used a footer that appears at Page Break and at the End of Table. This footer displays the total. I am tabulating the total in program lines in the main area of the table., like:

if wa_tab-emsex = 'M'.

total_men = total_men + wa_tab-number.

else.

total_women = total_women + wa_tab-number.

endif.

The field total is being cleared in the footer by use of program lines again.

My problem is that if page 1 displays, say 30 rows, and the 31st row onwards will be displayed in next page, then the total still includes the data in the 31st row. This means that incorrect total is getting displayed. If the total of 30 rows is to be 50, and the 31st row adds 5 to the total, then it prints 55 instead of 50.

I cannot use the calculations tab of table node, since the total is to be calculated separately for men and women. The data is all in a single internal table.

Please Help!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I tried that...But in some cases it doesnt work and instead gives a wrong value...

The problem occurs quite randomly, with some input values..And for some pages.

Hence, such a condition also fails.

Former Member
0 Kudos

Hi,

In your case, only after the process of the 31st record, it will be understood as the page is completed and proceed with the next page. The footer will then be displayed. Hence the issue is happening.

So in the footer,

Can you add one more program line and do substract with the last data?

Also, once the value is displayed in the footer, instead of refresh just assign the above value (last data) to the total variable.

For instance, in the footer:

  • Program line (On condition, current page is not equal to last page):*

if wa_tab-emsex = 'M'.

total_men = total_men - wa_tab-number.

else.

total_women = total_women - wa_tab-number.

endif.

  • Text node*

Display the total.

  • Program line:*

if wa_tab-emsex = 'M'.

total_men = wa_tab-number.

Clear total_women.

else.

total_women = wa_tab-number.

Clear total_men.

endif.

Regards,

Selva K.

Edited by: Selvakumar Krishnan on Jul 6, 2010 12:21 PM

Edited by: Selvakumar Krishnan on Jul 6, 2010 12:22 PM