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

Smartform Subtotal Issue

Former Member
0 Likes
1,707

Dear Experts,

I have an issue with smartform subtotals. In each page 5 lines are printed now. i.e if i have 20 lines in my internal table, its printing in 4 pages. The issue is with subtotals, I need to calculate subtotals for each page if its not the last page and in last page the grand total should be printed.

Right now i am calculating subtotals using program lines in main area of my table. The issue is my page break getting triggered after the 6 line but in form its printing only 5 lines.

lets say if my subtotal up to 5 lines is 100 and my total up to 6 lines is 120. Its printing 5 lines in my form but the subtotal is 120.

If i have only 6 lines in my internal table, in first page 5 lines are printed but sub total is 120 in next page 1 line is printed and (sub)total is zero.

I am not printing the subtotal in footer part of the table, instead iam using a different window and template.

Please suggest a solution to fix this issue.

Thanks in advance..

Rajesh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,368

You are right. I checked it. It's printing the subtotal adding the first item in second page in first page and similarly it's ignoring the last item in last page while printing subtotal. It can be resolved using the calculations tab in TABLE. Follow the steps given below.....

1. Create a table. Print the item lines in main area and in footer print the subtotal variable using text elements.

2. In footer initialize the subtotal after printing it. Also, check page break and at end table checkboxes for footer.

3. Now, instead of calculating the subtotal inside main area do it in calculations tab of the table with the following options

OPERATION TOTAL

FIELDNAME YOUR WORKAREA-FIELD TO BE SUMMED

TARGET FIELD SUBTOTAL FIELD

TIME AFTER LOOP

7 REPLIES 7
Read only

Former Member
0 Likes
1,368

Hi,

I don't see how that's its possible to get subtotals wrong if you know the EXACT number of lines printed on each page. You just add THAT many lines to get the subtotal.

B P

Read only

Former Member
0 Likes
1,368

It's hard to comment without seeing the smartform coding. I'll suggest to create a separate variable for subtotal and print it in footer part of the table at page break. The subtotal variable must be initialized after printing.

Read only

0 Likes
1,368

Thanks for your replies!!!

Coding is very simple i am just adding my work area field to a new variable i.e

Subtotal = subtotal + wa-field6.

After printing Subtotal in the form, i am clearing the variable subtotal so that every page will have the correct subtotal.

The actual issue was My code is executing before the page break is triggered. i.e The smartform is only able to decide after executing the code for 6 th line in my internal table that it cannot print the 6th line.

I have No page break checked for line type in my table. My issue is exactly as in the below thread. I am trying to implement the same solution provided in this thread.

[]

Read only

0 Likes
1,368

Hi All,

I have the same issue as rajesh's except that iam not displaying total at the end of everypage( it gets disaplyed at the end).

If I have 20 items on my page, the footer gets called for the 20th item only, but only 19 items get printed on the first page and 20th Item goes to the next page. Can someone help?

Read only

Former Member
0 Likes
1,369

You are right. I checked it. It's printing the subtotal adding the first item in second page in first page and similarly it's ignoring the last item in last page while printing subtotal. It can be resolved using the calculations tab in TABLE. Follow the steps given below.....

1. Create a table. Print the item lines in main area and in footer print the subtotal variable using text elements.

2. In footer initialize the subtotal after printing it. Also, check page break and at end table checkboxes for footer.

3. Now, instead of calculating the subtotal inside main area do it in calculations tab of the table with the following options

OPERATION TOTAL

FIELDNAME YOUR WORKAREA-FIELD TO BE SUMMED

TARGET FIELD SUBTOTAL FIELD

TIME AFTER LOOP

Read only

0 Likes
1,368

Thanks for the answer. It worked.

Read only

0 Likes
1,368

Hi,

I have tried same method you have mentioned, I have created table in main area I printed headers and in footer I have initialized Subtotal with carry forward and Brought forward separate and done my calculation in calculation tab in loop of main area. But still I am getting same issue. I have also removed loop in main area and tried in main window table still same issue and also tried different other methods but first page total and 3rd page sub total are coming correctly except 2nd page total, last item is added with third page first item and displaying in 2nd page. The grand total coming correct only issue in 2nd page subtotal.