Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

subtotals in smartforms

Former Member
0 Likes
325

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...

1 REPLY 1
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
292

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.