‎2006 Jan 12 12:18 PM
Friends,
I am printing page wise subtotals in the PO layout i desinged. My PO is a multiple page PO where i have two pages in my PO.
I am printing the PAGE WISE SUBTOTALS and then on the last page printing SUBTOTAL and FINAL TOTAL.
If line items are more in the PO, on each of the page subtotal will be printed and on the last page both subtotal and grand total will be printed.
This functionality i could achieve by designing two windows for the totals(subtotals window and totals window) and setting the events 'ONLY AFTER END OF THE MAIN WINDOW' and 'ONLY BEFORE END OF MAIN WINDOW'.
Problem description:
In case if my layout could accomodate the items in a single page, as first page itself is the last page, both subtotal and grand total are getting printed. In this case i want to restrict the subtotals from getting printed. I want to print only grand total.
I could not restrict this by putting condition in the condition tab, SFSY-FORMPAGE GT 1 for the subtotals window.
Any technique to solve the above?
thanks
Bill Joseph
‎2006 Jan 12 12:30 PM
Hi bill,
1. &SFSY-FORMPAGES&
use the above to detect total number of pages.
regards,
amit m.
‎2006 Jan 12 1:49 PM
Hi,
The alternative way is as follows :-
You can get the number of lines in an internal table using DESCRIBE TABLE i_itab line L_LINES.
Pass this variable ( L_LINES ) to smartform.
You would be having an idea of the max. number of line itmes which fit on 1 page.
So in the smartform you can put a logic to check whether variable ( L_LINES ) has line itmes less than max. no. of line itmes of 1st page. If yes then print both totals on 1st page else only print the subtotal.
Best regards,
Prashant
‎2006 Jan 12 2:04 PM
Hi Prashant,
This is thought of. But i have line items and after that i am printing long texts. I am printing the line items by using a table note and long text by using loop inside the table node. So this makes the process difficult, as the case i may not have some line texts i may have for some. This make writing logic cumbersome.
Bill Joseph.
‎2010 Feb 25 6:52 AM
Hi ,
First define the global variable for subtotal & grand total
In the first page display the table data normally and if you dont want to print the headers of the table check the condition in the header AT START OF TABLE
calculate the subtotal & grand totals (Ex. s_tot = s_tot + wa_vbaap-kwmwng g_tot = g_tot + wa_vbap-kwmeng)
Ex. page1 layout
Header window
main window
final window
In the final window create an alternative node (in flow logic )
for alternative node put the condition as
sfsy-page = sfsy-formpages
if TRUE
print the data as SUBTOTAL &g_tot&
print the data as TOTAL &g_tot&
ELSE (False node)
print the data as SUBTOTAL &g_tot&
Out put will be
page1 o/p
sales order material orderqty
1 M10 10
2 M11 20
3 M12 30
sub total 60 (s_tot value )
page2 onwards o/p
4 M13 30
5 M14 20
6 M15 15
subtotal 65 (s_tot value)
Total 125 (g_tot value )
Note : reset the value of s_tot = 0 at header level of the table at each page break.
Let me know if any concerns .........