2005 May 30 2:30 PM
Hello,
i'm trying to print a total only when i'm in the last page of a smartforms, and a subtotal in the footer of every page while is not the last one.
I'm checking the system variables SFSY-PAGE and SFSY-FORMPAGES but they seem to be calculated after the SF is processed. While debugging they have always the same value and i can't test if i am in the last page of the SF. This SF is for transaction VF03.
Thanks in advance!
Regards,
Laura
Message was edited by: Laura Quinteros
2005 May 30 2:52 PM
Hello Laura,
The correct way to do this would be to use the Calculations tab in your table in the smarform. Using this, you can use the Total function to add the value of a particular field into another field, and use the Before or After loop addition.
You can then output the value of the target fields after the table (which would appear on every page).
While this is the correct way to do it, we did encounter problems with it, because at the end of a page, for some reason, the smartform processor adds the last line of your table into the total!!!
We eventually gave up, and convinced the user to only have a grand total at the end.
I have found that running totals are much easier to do in good old Layout Sets (SE71). They never let you down
If, however, you try the above solution and run into problems, be so kind as to open up a OSS/SAPnet message with SAP and ask them to look into it.
All the best/Keep trying!
Martin
Oh yes, I forgot: The note also addresses the issue of page numbers in Smartforms.
Regards,
Martin
2005 May 30 2:42 PM
U might b having a main window right ? and is the end of main window signify end of page ? if so, set a flag when main window is over.
In the total window put the condition taht the flag should be set...and the flag will eb set only when the main window is complete.
Checking page numbers will not work. because it is computed dynamically.
Close this if it solves ur problem.
Remember to reward points !!
2005 May 30 2:52 PM
Hello Laura,
The correct way to do this would be to use the Calculations tab in your table in the smarform. Using this, you can use the Total function to add the value of a particular field into another field, and use the Before or After loop addition.
You can then output the value of the target fields after the table (which would appear on every page).
While this is the correct way to do it, we did encounter problems with it, because at the end of a page, for some reason, the smartform processor adds the last line of your table into the total!!!
We eventually gave up, and convinced the user to only have a grand total at the end.
I have found that running totals are much easier to do in good old Layout Sets (SE71). They never let you down
If, however, you try the above solution and run into problems, be so kind as to open up a OSS/SAPnet message with SAP and ask them to look into it.
All the best/Keep trying!
Martin
2005 May 30 3:09 PM
Oh yes, I forgot: The note also addresses the issue of page numbers in Smartforms.
Regards,
Martin
2005 May 31 3:53 PM
Hi Martin!
Thanks a lot for your answer, it was very helpful to me.
I used the Calculations tab as you told me to, and passed the "after loop addition" value to a variable for displaying subtotals on every page, and a grand total at the last page inside a "late processing window" window type (L).
I still have a problem on telling the SF that I don't need the subtotal on my last page, so I'll try to talk about it with the client, and convince him of having the subtotal an the total, both in the last page.
Oh! I read the note 359009 where it talks about this type of special window that exist in version 4.7 and can be implemented in version 4.6c and 4.6d by this note.
Thank you very much!
Regards,
Laura
2005 May 31 10:50 PM
Hi Martin,
About displaying only the total on the last page and not the subtotals in that very same page, I follow a colleague's idea: put the page number and the subtotal per page into an internal table in some code line of some node, and then process this internal table in a window of type L as I mentioned on the last post.
Regards,
Laura
2005 Jun 17 12:02 PM
I also find same problem with you, Michael, but now I found the better solution that is,
1) You should separate to several windows.
2) Lets say you just want to display 'TOTAL' at the last page after the last items in main window, you can define total at the independent window, double click this window > under 'condition" tab > you can see the box named "additional event" -> tick "only after end of main window"
3) Then now you can see those window only at the very last page after last item in main window.
p/s you can define several windows that you only want to print at the very last page (after last item in main window) using same steps above.
It works well same as commands:-
If &nextpage& = 0 in Sapscripts
Hope it helps you although is late.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |