18.1.11

SAP Note 18006 - Subtotals in SAPscript do not work

Symptom:

The current total in an invoice consisting of several pages is to be printed as carry-forward or subtotal on the current and the next page. However, the carry-forward either contains an incorrect value or no value at all.

Cause and prerequisites

The following reasons are possible:

1. No program symbols with Dictionary reference are used for the
totaling.

2. The carry-forward is positioned into the BOTTOM area. This, however,
is either processed immediately or at the beginning of a page and is
therefore not suitable.

3. If the carry-forward is positioned into the TOP area of the main
window (MAIN) on the next page, it may happen that the carry-forward
on the next page has a higher value if the text on the previous page
is too long and therefore held together by a PROTECT command, for
example. For this reason, the carry-forward must be written into a
local text symbol.

Solution
The carry-forward must be positioned into a 'VAR' window on the current page. It is then output in the TOP area of the MAIN window on the next page by means of a local text symbol. This can be achieved as follows:


1. You have to define the variables for amount and total (both must be
program symbols or Dictionary amount fields) at the beginning of the
main text in the layout set (before the first text element is
output). The SUMMING command in this example determines that the
amount in the totals variant is summed up
automatically on each page for each output.
Thus, at the bottom of the page contains the
carry-forward or the sum total. A local symbol is
also defined in this example to output the sum total on the last
page:

/: SUMMING INTO
/: DEFINE = ' '

2. At the end of the main text in the layout set, that is, if the last
element is output in the main window, the value of the local text
symbol is set to a different value, for example 'X':

/: DEFINE = 'X'

3. The carry-forward in the TOP area of the next page is output by
means of a local text symbol with text number
'Carry-forward' and tab. The corresponding text element is also
defined in the main window:

/E CARRY
*

(CALL FUNCTION WRITE_FORM EXPORTING ELEMENT = 'CARRY'
TYPE = 'TOP')

4. The carry-forward window on the current page is defined as 'VAR'
window and positioned at the end of main window on the page. There
the carry-forward is output and the local text symbol
is defined for an output in the TOP area of the next page. In
addition, the sum total is output on the last page by means of a
local text symbol . Thus, the carry-forward window
contains the following window text (in this case, a predefined
paragraph T1 with tab is used):

/: IF = 'X'
T1 Total:
/: ELSE
T1 Carry-forward:
/: DEFINE =
/: ENDIF

No comments:

Post a Comment