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

SUbtotal problem in smartforms

former_member211992
Active Participant
0 Likes
1,733

Dear all

I have calculated subtotal for every page using calculations

subtotal for the first page coming correctly,, but from the second page its adding the value of last row of the internal table rather first row value of  second page ,,its omitting first row value of every page ,, its happening at each and every page..

Regards

9 REPLIES 9
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,685

Please attach a screen shot of your calculations and at what time the values are being calculated and displayed

Read only

0 Likes
1,685

Read only

0 Likes
1,685

Hi KArthik

In which node you are printing sub total ? Please make sure you have marked at end of page check box.  Plus clear the value of sum after it gets printed

Nabheet

Read only

0 Likes
1,685

Hi-

Follow below steps to display Sub-totals in smart forms:

-> Create a new variable in your form which is of type 'I' say gv_sub_total.

-> In your Table -> Main Area -> Create a Program Line under your text cell with below code:

gv_sub_total = gv_sub_total + wa_itab-val2. (Don't forget to give this variable in I/P and O/P parameters).

-> On your table Footer-> Output Options -> Select check box at Page Break.

-> Inside your Footer create a text to display Sub-Totals value.

->  Just underneath the text create a Program Line and write below code to clear sub total variable:

CLEAR gv_sub_total.

-> Now your sub-total value will be displayed whenever their is a page break in Smart Form nut what in case your page ends in middle say last page there sub total will be missing. Hence you have to create a template underneath the table with the text cell displaying gv_sub_total value with a condition gv_sub_total > 0.

This is working for me:

-Venkat

Read only

0 Likes
1,685

Hi nabheet,

Im using footer of the table

Read only

0 Likes
1,685

Dear venkat,

i have done as you said but problem is in the second page ther is one line item ,,but its value calculated in the first page itself .

page 1

               10

               10

                 5

subtotal = 30

page2

                5

Read only

0 Likes
1,685

Could you please share your code which you have written for calculating sub-totals in program lines?

Also paste the screen shot of your footer expanding till your text cells.

-Venkat

Read only

0 Likes
1,685

IF it_final-shkzg = 'S'.

  w_debit_sum = w_debit_sum + it_final-wrbtr.

ELSEIF  it_final-shkzg = 'H'.

  w_credit_sum = w_credit_sum + it_final-wrbtr1.

  ENDIF.

Read only

0 Likes
1,685

Hi-

Please write below code under Main Window -> Table -> Main Area -> Text Cell -> Program Line.

IF it_final-shkzg = 'S'.

  w_debit_sum = w_debit_sum + it_final-wrbtr.

ELSEIF  it_final-shkzg = 'H'.

  w_credit_sum = w_credit_sum + it_final-wrbtr1.

  ENDIF.

-Venkat