Generate Intermediate Results

Use

By default all values in a column are used in the calculation during aggregation. However, you can also generate intermediate results. When you do this, you group together data records containing the values for an intermediate result and display the intermediate result in a separate results row.

To generate intermediate results, you have to make certain settings:

  • To specify in which column the values from which the intermediate results are calculated are located, generate an aggregation object for the desired column. The overall result is displayed in the results row.

  • To specify which data records are contained in an intermediate result, put the data records into groups. You can sort the ALV output by the column containing the criterion for the intermediate result.

  • To then display the intermediate results, you calculate the intermediate results using the column with the criterion.

Prerequisites

  • You have generated an aggregation object for at least one aggregatable column.

  • The column with the criterion for intermediate results is a column that cannot be aggregated.

  • You are able to generate intermediate results for up to nine columns.

Features

With intermediate results, you can:

For all of the following functions, this is valid:

ALV Tool

Display Type

Function available

Simple, Two-Dimensional Table

Classic ABAP List

Yes

Full Screen

Yes

In the Container

Yes

Hierarchical-sequential list

Classic ABAP List

Yes

Tree Structure

Full Screen

No

In the Container

No

Generate intermediate results

To display intermediate results in a column that already has an aggregation object, use the sort object from another column.

  • alphanumeric data type or

  • Numeric text (NUMC or n), assuming you have not expressly permitted aggregation for this data type (see chapter Making Settings for Aggregation, Section Allow and Forbid Aggregation)

    Function

    Class

    Method

    Generate intermediate results

    CL_SALV_SORTS

    ADD_SORT (Parameter SUBTOTAL)

    CL_SALV_SORT

    SET_SUBTOTAL

    Check whether intermediate results are generated for a specific column

    CL_SALV_SORT

    IS_SUBTOTALLED

Hide subvalues of intermediate results

You are able to hide the data records that form the subvalues of an intermediate result. To do this, specify the column that contains the criteria for the intermediate results, not the column that contains the calculated values.

Function

Class

Method

Hide subvalues of intermediate results

CL_SALV_SORTS

SET_COMPRESSED_SUBTOTAL

Get column that only displays results rows

GET_COMPRESSED_SUBTOTAL

Check whether the rows for an intermediate result are hidden or displayed

CL_SALV_SORT

IS_SUBTOTAL_COMPRESSED