cancel
Showing results for 
Search instead for 
Did you mean: 

script pagewise total

Former Member
0 Kudos

hi,

i need to do pagewise totals..

like if for a certain SO number there are 100 items..they get carried to next page..

so i want the pagewise totals for that particular SO number.

how can i do it?

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member196280
Active Contributor
0 Kudos

Define a variable and sum up, once you move to next page refresh the contents of your variable and apply the same logic.

Regards,

SaiRam

Former Member
0 Kudos

hi,

if i sum up the value its giving is the sum of entire items amount..on every page

hw can be the condition given?

former_member673464
Active Contributor
0 Kudos

hi try this ..

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:

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& = ‘ ‘

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 ‘X’:

/: DEFINE &LASTPAGE& = ‘X’

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

  • &’Carry forward:,,’CARRY&

(CALL FUNCTION WRITE_FORM EXPORTING ELEMENT = ‘CARRY’

TYPE = ‘TOP’)

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& = ‘X’

T1 <H>Grand total:,,&SUMTAB-TOTAL&</>

/: ELSE

T1 <H>Carry forward:,,&SUMTAB-TOTAL&</>

/: DEFINE &CARRY& = &SUMTAB-TOTAL&

/: ENDIF

regards,

veeresh

Former Member
0 Kudos

hi..i tried using it..

i took a seperate variable window and there i defined the variables in following way

in var window.

/:define &SUMTAB-AMOUNT&

/:define &SUMTAB-TOTAL&

/: SUMMING &SUMTAB-AMOUNT& INTO &SUMTAB-TOTAL&

but im not being able to get the pagewise total its comoing zero.

what shud be done?

dev_parbutteea
Active Contributor
0 Kudos

Hi,

/:define &SUMTAB-AMOUNT&

/:define &SUMTAB-TOTAL&

/: SUMMING &SUMTAB-AMOUNT& INTO &SUMTAB-TOTAL&

I think that you didn't assign anything to SUMTAB-AMOUNT !

So, its going to be 0 obviously!

Regards,

Sooness

Former Member
0 Kudos

hi,

earlier i did i assigned the the field name in which the amount has been stored,

/: define &sumtab-amount& = wa_final-kwmeng.

but still the pagewise total was coming zero!

dev_parbutteea
Active Contributor
0 Kudos

Hi Rashmi,

if summing doesn't work try writnig a routine for this.

/:define &SUMTAB-TOTAL&

/:PERFORM SUM IN PROGRAM_NAME.

/:USING <b>existing_field</b>

/:CHANGING &SUMTAB-TOTAL&

/:ENDPERFORM.

Regards,

Sooness

Former Member
0 Kudos