Show TOC

Calculating Grand TotalsLocate this document in the navigation structure

Prerequisites

The same prerequisites as for Examples.

Context

You want to calculate a grand total on the PRICE column of a table. This column refers to the currency field CURRENCY. All values of the column have the same currency.

Procedure


  1. For table BUSINESS define a global structure to contain the result of the calculation, for example, R_BUSINESS. Create a program lines node before the table node and assign to R_BUSINESS-CURRENCY the currency used for the price in the table.

  2. On the Calculations tab fill the following fields:

    Column

    Value

    Operation

    Total

    Field name

    WA_BUSINESS-PRICE

    Target field name

    R_BUSINESS-PRICE

    Time

    After Loop

    Initialization

    (active)

  3. To display the grand total, include a table line into the footer and include a text node into this table line. In the text node, include R_BUSINESS-PRICE and R_BUSINESS-CURRENCY.

  4. You can specify whether to display the total at the end of each page (as subtotal) or as a grand total at the end of the table. To do this, activate or deactivate the option At Page Break of the footer.

Results

The total appears in the footer, formatted in the currency CURRENCY.