Show TOC

Calculating SubtotalsLocate this document in the navigation structure

Prerequisites

The same prerequisites as for Examples.

Context

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.

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

    Summe

    Feldname

    WA_BUSINESS-PRICE

    Zielfeldname

    R_BUSINESS-PRICE

    Zeitpunkt

    Nach Schleife

    Initialisierung

    (active)

    Zurücksetzen

    Sortierkriterium

    Sortierkriterium

    CURRENCY

Results

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