Show TOC Entering content frame

Background documentation Interim Results Locate the document in its SAP Library structure

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

To generate interim results, you have to provide certain information:

·        To specify in which field the values from which the interim results are calculated are located, generate an aggregation condition for the desired field. The overall result is displayed in the result row.

·        To specify which data records are contained in an interim result, group the data records: You sort the ALV output by the field that includes the criterion for the interim result.

·        To then display the interim results, you calculate the interim results using the field with the criterion.

Note

The most common way of generating interim results is to use subtotals. That is why you often find this term in place of interim results for all aggregation types. Nevertheless you can of course generate interim results (or “subtotals”) for all other aggregation types.

You are able to make the following settings for interim results:

·        Generate interim results

·        Set steps for expanding interim results

·        Set the position of the result rows (see Settings for Aggregation)

·        Forbid generation of interim results

Prerequisites

·        You have generated an aggregation object for at least one aggregatable field.

·        The field with the criterion for interim results is not an aggregatable field, and therefore has an alphanumeric data type.

Generating Interim Results

To generate interim results in a field that already has an aggregation condition, generate a sort condition for the field of a column (another column) (see Sorting).

In this sort condition, define whether interim results are to be generated. To do this, use the methods of the class CL_SALV_WD_SORT_RULE.

Methods for Generating Interim Results

Function

Method

Generate interim results

SET_GROUP_AGGREGATION

Check whether interim results are displayed

GET_GROUP_AGGREGATION

Setting Steps for Expanding Interim Results

If you have defined subtotals for several alphanumeric fields, there are multiple subtotal steps: The interim results are subdivided hierarchically and are marked with a different number of points according to their step. The user can use these points to show and hide the entries for the individual interim results. You can use your application to show or hide the entries of one or more complete subtotal steps. You use the methods of the interface class IF_SALV_WD_FIELD_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Steps for Expanding Subtotals

Function

Method

Set highest level to be displayed

SET_EXPAND_LEVEL

Get current subtotal step

GET_EXPAND_LEVEL

Forbidding the Generation of Interim Results

By default, the UI elements that the user requires to generate interim results are not visible in the Settings dialog box. You must make the UI elements available to the user if you want him or her to be able to use them (see Providing Standard ALV Functions). These UI elements then become visible in the Settings dialog box on the tab page Sorting and Subtotals. The list of sorted columns contains an additional indicator Subtotals for alphanumeric data types.

You can forbid the generation of interim results for individual fields. This has the following effects:

·        The indicator is no longer displayed for the column in question on the Sorting and Subtotals tab page of the Settings dialog box.

·        If you generate interim results for this field in your application, these settings have no effect in the ALV output.

To forbid the generation of interim results for a field, use the methods of the interface class IF_SALV_WD_SORT (implementing class CL_SALV_WD_FIELD).

Methods for Forbidding Interim Results

Function

Method

Forbid the generation of interim results

SET_GROUP_AGGREGATION_ALLOWED

Check whether generating interim results is permitted

IS_GROUP_AGGREGATION_ALLOWED

 

 

Leaving content frame