Calculating Subtotals

Use

You want to display subtotals after a sort level break of a sort criterion. In the example below, we use the currency field CURRENCY as the sort criterion. Thus, each subtotal refers to one currency.

Prerequisites

The same prerequisites as for Examples.

Procedure

  1. For table BUSINESS define a global structure to contain the result of the calculation, for example, R_BUSINESS .
  2. On the Data tab enter CURRENCY as sort criterion and mark Event on Sort End .
  3. In the navigation tree create a table line as inferior node of the event node CURRENCY Event on Sort End and select a line type for subtotal output. In our example, we assume that the line type consists only of one line.
  4. Before the output of the subtotal create a program lines node in the cell. To display the subtotal after the current currency, assign it to the result field in the program lines node: R_BUSINESS-CURRENCY = WA_BUSINESS-CURRENCY .
  5. After the program lines node insert a text node and include the fields R_BUSINESS-PRICE and R_BUSINESS-CURRENCY into this text.
  6. Go to the Calculations tab of your table node and fill the following fields:

Column

Value

Operation

Total

Field Name

WA_BUSINESS-PRICE

Target Field Name

R_BUSINESS-PRICE

Event

After Loop

Initialization

(active)

Reset

Sort Criterion

Sort Criterion

CURRENCY

Result

The subtotals are formatted according to the relevant currency and displayed after each sort level.