cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect subtotals in smartform in SAP 4.6C

Former Member
0 Kudos

Dear all,

first I want to mention I already scanned the forum for my print problem, but didn't find a concrete solution to my problem.

Before you reply, please note I am working in SAP release 4.6C .

I probably have the same problem as Maple Bautista with smartform, subtotal and page break for SAP release 4.6C (so no "Calculation" tabview is available in table node) :

The first page will show one item quantity too much in the subtotal (namely the qty of the first item line of the NEXT page)

and

the next page will show one item quantity too less in the subtotal (namely the qty of the first item line of the CURRENT page).

Current settings in the smartform :

The item lines all are page protected.

In the text elements the [Only at page break] is switched off.

Unfortunately I am missing the description to the solution in the thread of Maple .

Thanks in advance for your reply in this.

Accepted Solutions (1)

Accepted Solutions (1)

marius_greeff
Active Participant
0 Kudos

Hi,

The problem you have can be caused when you add your totals. When a page-break is triggered and you use your work area and table of your items in another window it will change the data already in the work area wich would print on the next page as the first item. If you have a seperate window for your totals and loop thru items to add up, do this only after your main window has printed all the lines. Else in the initilization of the form add your totals into a variable.

Subtotals sum do that in code with you last column and not before your first column. A page break is only triggered when the system won't fit the text to print on the page. At that time it is already in your work area and will print on the next page and why if you change that values will mess up the next page first line to be printed. If you added your value to subtotal it would include the first item on the next page because that code was already executed before the page-break.

Hope this is somehow understandable and helpfull.

Regards,

Marius

Former Member
0 Kudos

Hi Marius,

thank you for your answer. Why the subtotal print problem is happening, is clear to me at this moment, but I still have the problem of calculating the subtotal.

For now, I use a correction during page-break (if SFSY-PAGEBREAK eq 'X' ) in the footer node by subtracting the extra quantity and add the missing quantity in the header node.

Although I am not proud of this own made logic, it works up till now. Unfortunately the user found an (exceptional) error .

Therefore I have to look for a more solid program logic.

We are still working in SAP release 4.6C, but I found some information in the SAP help (for ECC 5.0) about calculating subtotal and grand total in smartform. However, it gets fuzzy at the part of the use of field GS_4NEXT_ADDITION . The explanation of delaying the calculation by using this field seems reasonable, but it is not explicit clear how the program logic in the example works in that way.

If someone knows what I mean with this SAP help and can explain it more clearly...

Thanks again !

Answers (2)

Answers (2)

Bhushan_hs
Participant
0 Kudos

Hi Chi Wai Cheung,

Did you solve this issue i am facing the same issue here please guide if you have got any solution.

Thanks & Regards,

Bhushan.

Former Member
0 Kudos

Hi guys,

Have your resolved the issue yet. I am having the same problem. I would appreciate your help.

Thanks

Linda

Former Member
0 Kudos

OK. I resolved the issue by doing calcuations in the table. Not via program lines. Thanks for the tips.

Former Member
0 Kudos

Whenever we have had issues with incorrect subtotals/totals, it was due to the WINDOW TYPE where the values were printed. By default, the type is SECONDARY WINDOW. Changing to FINAL WINDOW causes the value to print after calculations are performed.

Former Member
0 Kudos

That is very nice to know. Thanks for the tips.

Former Member
0 Kudos

As of release 6.10

1. Define Work Area of Interface Table (i.e. WA_T_SUMS LIKE YLIPS (type of LIPS))

2. In Smartforms Table, mark the Table Line type of the Items to NO PAGE to make sure item appears on page relevant to SumTotal.

3. Table DATA Tab (i.e. ILIPS into GLIPS)

4. Table Calculations Tab, Operation: SUM Total, Field Name: GLIPS-NETWR, Target Field Name: WA_T_SUMS-NETWR, Time: After Loop

5. WA_T_SUMS-NETWR printed in FOOTER text.

For previous releases you can use example logic of "GS_4NEXT_ADDITION" in supplied Smartform SF_TOTAL. Be sure mark your Table Item "No Page" as in 2 above.

CROSS