cancel
Showing results for 
Search instead for 
Did you mean: 

Subtotal on every page and on last page grand total

Former Member
0 Kudos

Hi all,

I want to do subtotal on every page and on last page there is grand total.

Any suggestions welcome,

Regards,

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

Hi All,

How to add event in smart forms.

Also my subtotal is not getting displayed correctly if one item is getting extended to the next page.

Please suggest.

jignasa

Former Member
0 Kudos

Hi Jigs ,

If your data is extended to the next page use protect and protect to make appera on the same page .

Then you might get your total right.

You can rather post your question on a new thread itself!

Much Regards ,

Amuktha .

Former Member
0 Kudos

Hi Navdeep ,

Here's wat you can try on your form.

the logic is simple..

if your &nextpage& = 0

that becomes your last page wher you have to print your grand total .

else .

you have to find out the subtotal .

Sample :

/: if &nextpage& = 0

: 'Grand Total'

/: Else

: 'Sub total'

/: Endif

Hope it helps!

Much Regards ,

Amuktha .

Former Member
0 Kudos

Hi Navdeep,

Refer the standard form for the subtotals and grand total :

SF_subtotals

SF_totals

Regards,

Sravanthi

Former Member
0 Kudos

Hi Hemal,

Please let me know the solution . i m facing the same problem but not able to solve it.

Thanks

Jignasa

Former Member
0 Kudos

Hi Hemal,

I take 2 Variables one variables ReInitialize when page starts and add the values at end of every page then displays it.

Second variable is global and add the values of first variables on each page.

Regards,

Navdeep

Former Member
0 Kudos

Hi SAPBIES,

There is other method to get sub-total on the page.

Please let me know if this post is still unresolved then i will give my solution.

Thanks,

Hemal

Former Member
0 Kudos

Hi,

Subtotal on every page can be done :

In the main window --> In the table --> footer area --> create the text node for the subtotal.

Grandtotal:

Create the secondary window after the table and in that create the text node for the grand total and display.

Regards,

Sravanthi

Former Member
0 Kudos

Hi,

Declare the variables for your subtotals and display them in all pages,

and add all your local variables and the final result you display in the Grand Total of your page.

Still not clear means revert back more precisely how many pages and what are fields that you are using etc.

Cheers!!

VEnk@

Former Member
0 Kudos

Let there are 2 pages and Quantity is field for subtotal.

Page 1

<Main Window>

Qty

10

20

-


30 - Subtotal Page 1 of 2 continued..

-


Page 2

Qty

13

4

2

-


19 - Subtotal Page 2 of 2

-


-


49 - grand total

-


Hope this helps ,

Regards,

Former Member
0 Kudos

Hi Venkat,

Please see my comments hope now it is clearly understood .

Regards,

Former Member
0 Kudos

Hi

I think u need to create a new footer window type VAR where u print the subtotal and grand total:

The grand total will be print as soon as the last page will be printed:

IF &NEXTPAGE& = '0'.

-


> GrandTotal

ELSE

-


> Subtotatal

ENDIF.

U can also see the help (help.sap.com):

Assume that for a multiple-page invoice, you want to print the current total as carry forward amount or subtotal on the current page and on the subsequent page. However, the carry forward amount is incorrect or missing.

The following causes are possible:

    * You do not use program symbols with Dictionary reference for totalling.

    * You place the carry forward amount into the BOTTOM area. SAPscript processes the BOTTOM area at the beginning of a page; therefore it is not suited for carry forward amounts.

    * If you place the carry forwards amount into the TOP area of the main window on the subsequent page, the carry forward amount may be higher than it should be: This happens if the last part of text of the previous page does not fit onto the page, but the text is held together, for example, by a PROTECT command. In this case, a local text symbol must receive the carry forward amount.

You must place the carry forward amount on the current page into a window of type VAR. On the subsequent page, use a local text symbol to print the amount in the TOP area of the main window:

   1. At the beginning of the form main text (before printing the first text element), define the amount variable and the total variable (both must be program symbols or Dictionary amount fields).

      In the example below, we use the SUMMING command to determine that for each output of &SUMTAB-AMOUNT& the system automatically sums up the amount in the total variable &SUMTAB-TOTAL&. At the end of the page, &SUMTAB-TOTAL& contains the carry forward amount of the current page or the grand total, respectively.
      In this example, we also define a local symbol &LASTPAGE& to print the grand total on the last page.

      /: SUMMING &SUMTAB-AMOUNT& INTO &SUMTAB-TOTAL&
      /: DEFINE &LASTPAGE& = u2018 u2018
   2. At the end of the form main text (when printing the last text element of the main window), set the local textsymbol &LASTPAGE& to a different value, such as u2018Xu2019:

      /: DEFINE &LASTPAGE& = u2018Xu2019

   3. To print the carry forward amount in the TOP area of the subsequent page including the pre-text 'Carry forward' and a tab, we use the local text symbol &CARRY. The corresponding text element is also defined in the main window:

      /E CARRY
      * &u2019Carry forward:,,u2019CARRY&

      (CALL FUNCTION WRITE_FORM EXPORTING ELEMENT = u2018CARRYu2019
      TYPE = u2018TOPu2019)
   4. Define the carry forward window on the current page as type VAR and position it at the end of the main window of the page. Print the carry forward amount there and define the local text symbol &CARRY& to print the amount again in the TOP area of the subsequent page. Use the local text symbol &LASTPAGE& to print the grand total on the last page. The carry forward window then contains the following text (define it as paragraph T1 with tab):

      /: IF &LASTPAGE& = u2018Xu2019
      T1 <H>Grand total:,,&SUMTAB-TOTAL&</>
      /: ELSE
      T1 <H>Carry forward:,,&SUMTAB-TOTAL&</>
      /: DEFINE &CARRY& = &SUMTAB-TOTAL&
      /: ENDIF

Max

Edited by: max bianchi on Nov 7, 2008 5:05 PM

Former Member
0 Kudos

Hi If you take table node, Under calculations tab,

select the field for which the subtotal needs to be done and select opertions as total for before loop the same opertaion for grand total after loop.

Hope it is hopeful.

Former Member
0 Kudos

30 - Subtotal Page 1 of 2 continued..

create sepe text for above one and in condition tabof text

click the -


>only before the end of main window

19 - Subtotal Page 2 of 2

49 - grand total

create sepe text for above one and in condition tabof text

click the -


> only after end of main window..

here text will trigger as per the condition...

Former Member
0 Kudos

Hi

Where?

Max

Former Member
0 Kudos

Want to print the subtotal at end of each page and grand total at last page .

There is main window which has table loop so as soon as this loop continues the subtotal prints eg: shown below

Page 1

<Some windows>

<Main Window>

- Table Loop

- Sno Qty Material

1 10 M1

2 20 M2

-


Subtotal 30

-


Page 2

- Sno Qty Material

3 10 M3

4 3 M4

5 8 M5

-


Subtotal 21

-


-


Grand total 51

-