Show TOC

Calculation and InitializationLocate this document in the navigation structure

Use

For your calculation you must specify the following events:

  • The calculation event, that is the event at which to execute the operation you selected. You select this event in the Event column from a list box.

  • The initialization event, that is the event at which to reset the Target Field Name you selected. When executing calculations on all items of a table, mark the checkbox of the Initialization column; when executing calculations on items of a sort level, use the fields Reset and At Field Name to specify a sort criterion.

    Note

    You also have the option of not specifying an initialization event. For example, you may want to use the result of a calculation of the preceding node in the tree as initial value.

Events and Output

SAP Smart Forms automatically inserts the calculations and initializations into processing. The events are not visible in the navigation tree; they are triggered implicitly by SAP Smart Forms. In the table below, which contains one sort criterion, these implicit events are highlighted by different colors:

Note

To simplify this diagram, we assume that in the header, main, and footer areas only table lines appear as inferior nodes. However, the tree could just as well contain a loop or a folder.

Implicit Calculation and Initialization Events

Initialization

Table

Header Area

CARRID Event on Sort Begin

Reset Sort Criterion CARRID

Before Sorting

Table Line

...

Table Line

Main Area

Before Loop

Table Line

....

Table Line

After Loop

CARRID Event on Sort End

Table Line

...

Table Line

After Sorting

Footer

Note

The processing of loops and tables results in an out-of-sync execution of program lines nodes and their subsequent table output. In contrast, the automatic calculations using the Calculations tab and their subsequent output are in sync. Therefore, when you execute calculations via the tab, there are no special options for output of subresults before a page break. (See also: Summing Up Different Currencies).