‎2006 Jul 17 9:53 AM
hi,
i am working on a script.
in my output i have 3 pages in form
for each page i have to display page total
and on last page i have display the grand total.
Can any one tell me how shud i do it.
Rgds,
Fattesingh
‎2006 Jul 17 9:56 AM
hi Gaikwad,
Try using <b>&sum&</b> statement in the footer of each page...
‎2006 Jul 17 10:05 AM
Just have a separated element for your total. You are probably looping a table in the print program and writing some detail lines. After that loop just write the Totals element. Doing this will put the totals on the last page of the sapscript.
Loop at itab.
call function 'WRITE_FORM'
EXPORTING
element = 'ITEMS'
window = 'MAIN'
EXCEPTIONS
others = 1.
Now write the SUB totals.
call function 'WRITE_FORM'
EXPORTING
element = 'SUBTOTALS'
window = 'MAIN'
EXCEPTIONS
others = 1.
endloop.
Now write the totals.
call function 'WRITE_FORM'
EXPORTING
element = 'TOTALS'
window = 'MAIN'
EXCEPTIONS
others = 1.
‎2006 Jul 17 11:18 AM
Hi Gaikwad,
What you can do is in the sap script write an if condition on page no storing the page no and continuously keep on checking the page no condition before printing each line item.
Whenever you observe any change in the page no it means that the main window is complete, in the meanwhile keep adding the total in a variable and thus for each page change you will have page total calculated.
You can use system variable &page& for this.
Please Reward points if helpful.
Regards.
Sunmit.
‎2006 Jul 17 11:23 AM
u must be looping at the internal table and u write_form fm to print the main window content. in the loop use a variable (for eg : sum) and sum up the values in each iteration. Then in the main window , in the text element which u use to display the data write
/: BOTTOM
&SUM&
/: ENDBOTTOM
this will be exeuted before the next page is called.