cancel
Showing results for 
Search instead for 
Did you mean: 

Hi Question on Smart forms

Former Member
0 Kudos

Hi Experts,

I need to display sub totals at the end of page before triggering to new page .....i know how to display grand total by using calculation ., field name and target field name but i need to display at the end of every page ....

Thanks & Regards

Bhaskar Rao.M

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bhaskar,

Please see below info.

<b>Summing a Program Symbol: SUMMING</b>

The SUMMING command is used for accumulating a total value for a program symbol. The command should be specified just once. Then, each time the specified program symbol is formatted, its current value is added into the total symbol. Several program symbols may all be added into a single total symbol.

Syntax:

/: SUMMING program_symbol INTO total_symbol

SAPscript cannot create the field for the total dynamically. The summing symbol used for totalling and the accompanying program symbol(s) must be declared with TABLES in the ABAP program. Otherwise, only zero is added. Declaring the symbol with the DATA statement is not sufficient (global data).

<b>Summing and Carrying Forward is Incorrect</b>

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

Reward helpful answers.

Thanks,

Nagendra

Former Member
0 Kudos

hello to display the sutotals u can use the table footer.. and insert a table line in a footer and insert a text to print the sutotal...

to calculare the subtotal. use the Calculation tab of the TABLE and calculate the value... by doing this subtotal will be printed on every page. but u neeed to pring the subtotals belongs t to that page only so wht i have to do is after printing the subtotal using the footer node of the table clear the value usign the program lines.

<b>Please Colse the thred when ur problem is solved,Raward Helpful answers</b>

Regrads

Naresh Reddy

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

This will be very easy if u have only all the windows present in single page.

If you have single page, create new window(secondary) in the last, and put ur logic to this. this will get display in each page. (this is the logic we use to display the page numbers for each page).

Reward points if found helpful

Regards,

Seema

Former Member
0 Kudos

Hi,

Check the link...

Reward points if it is helpful...

Regards,

Omkar.