Generating Intermediate Results
By default all values in a column are used in the calculation during aggregation. However, you are also able to generate intermediate results. You group the data records that contain the values for an intermediate result and display each intermediate result in its own results row.

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 provide certain information:
· 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, group the data records: You sort the ALV output by the column that includes the criterion for the intermediate result.
· To then display the intermediate results, you calculate the intermediate results using the column with the criterion.

The most common way of generating intermediate results is to use subtotals. That is way you often find this term in place of intermediate results for all aggregation types. Nevertheless you can of course generate intermediate results (or “subtotals”) for all other aggregation types.
· 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.
You are able to make the following settings for intermediate results:
· Generating Intermediate Results
· Hide Subvalues of Intermediate Results
· Determining the Position of the Results Row
· Displaying the Labels for Intermediate Results in the Results Row (Section Columns with Special Functions)
· Displaying Exception Icons in the Results Row of the Intermediate Results (Section Using Graphic Columns, Exception Column)
For all of the following functions, this is valid:
Display type ALV Tool |
Classic ABAP list |
Full screen |
In the Container |
Simple, two-dimensional table |
Yes |
Yes |
Yes |
Hierarchical-sequential list |
Yes |
|
|
Tree structure |
|
No |
No |
To display intermediate results in a column that already has an aggregation object, use the sort object from another column.

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)
Methods
Function |
Class |
Method |
Generating intermediate results |
CL_SALV_SORTS |
ADD_SORT |
CL_SALV_SORT |
SET_SUBTOTAL |
|
Check whether intermediate results are generated for a specific column |
CL_SALV_SORT |
IS_SUBTOTALLED |
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.
Methods
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 |