Show TOC

Generating Intermediate ResultsLocate this document in the navigation structure

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.

Note

You are also able to generate aggregations in and display intermediate results in the tree structure. However, here the intermediate results are automatically generated from the values of the subnodes in every node that has subnodes. The following information is thus only valid for the simple, two-dimensional table and the hierarchical-sequential list.

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.

    Note

    The most common way of generating intermediate results is to use subtotals. This term is therefore often used in place of the term intermediate results for all aggregation types. Nevertheless, you can also generate intermediate results (or "subtotals") for all other aggregation types.

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

Fullscreen

Yes

In the Container

Yes

Hierarchical-sequential list

Classic ABAP List

Yes

Tree structure

Fullscreen

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.

Caution

The column that contains the sort object has to have one of the following data types:

  • 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