2010 Jan 07 3:03 PM
Hi ,
Iam have created a smartform where i need to calculate pagewise subtotal . i have declared a variable and used that variable in claculations tab in the main loop and used before loop iam getting subtotls but iam facing a problem it is for eg. if iam having 2 pages in the first page three line items and second page 2 items are displayed like
1 item desc 1000
2 item decs 1000
3 item desc 1000
then i should get the subtotal as 3000
second page
4 item desc 1000
5 item desc 1000
then subtotal should be 5000. l
ike this i should get but what iam getting is in the first page iam getting subtotal as 4000 and second page getting subtotal as 5000 which is wrong. please help me in this .thanks...
Hi ,
Iam have created a smartform where i need to calculate pagewise subtotal . i have declared a variable and used that variable in claculations tab in the main loop and used before loop iam getting subtotls but iam facing a problem it is for eg. if iam having 2 pages in the first page three line items and second page 2 items are displayed like
1 item desc 1000
2 item decs 1000
3 item desc 1000
then i should get the subtotal as 3000
second page
4 item desc 1000
5 item desc 1000
then subtotal should be 5000. l
ike this i should get but what iam getting is in the first page iam getting subtotal as 4000 and second page getting subtotal as 5000 which is wrong. please help me in this .thanks...
2010 Jan 07 10:28 PM
I have seen this effect mentioned before. Take a look at where you place the code that calculates the subtotals. Loops are sometimes executed not exactly as we expect. E.g. on the first page the loop gets actually executed 4 times, except at the 4th pass SAP realizes 'aha, I don't have enough space and I need to start a new page!', but subtotal have already been calculated. If you're using Page Break command, also pay attention to its placement.
You also might need to use some additional flag. Just experiment with the form and you'll find a solution. It is just counter-intuitive, that's all.