Calculating (Aggregation) 
You can perform calculations in fields that have a numeric data type. You generate an aggregation condition. The result of the calculation is then displayed in a separate results row.
Usually all values in a field are used in the calculation when you perform aggregation. You can also obtain intermediate results. To do this you have to sort the ALV output and group the rows that you want to use for the interim result (see Sorting).
You can make the following settings for aggregations:
Create, get, and delete functions
Make settings for aggregation (see Settings for Aggregation)
Generate intermediate results (see Intermediate Results)
Hiding and showing interface elements for calculations or subtotals
You are able to create a maximum of one aggregation rule for a field. Aggregation is a property of a field in the ALV output. To create, get, or delete the aggregation rule of a field, use the methods of interface class IF_SALV_WD_AGGR (implementing class CL_SALV_WD_FIELD).
Methods for creating, getting, and deleting the aggregation rule
Function |
Method |
Get aggregation rule |
GET_AGGR_RULE |
Create aggregation condition |
CREATE_AGGR_RULE |
Delete aggregation rule |
DELETE_AGGR_RULE |
The aggregation rule of a field is represented by an object of class CL_SALV_WD_AGGR_RULE.
Note
If you assign a new data table with a new structure to your ALV output, all aggregation rules for all fields are deleted automatically.