You are able to make the following settings for the calculation of field values:
· Set aggregation type
· Set the position of the result row
· Forbid aggregation for a field
The following calculation (aggregation) types are available:
· Total
Adds together all values of the field
· Minimum
Determines the smallest value of the field
· Maximum
Determines the largest value of the field
· Average value
Determines the geometric average of all values of the field
To define the calculation type, use methods of the class CL_SALV_WD_AGGR_RULE.
Methods for Changing the Calculation Type
Function |
Method |
Set calculation type |
SET_AGGREGATION_TYPE |
Get calculation type |
GET_AGGREGATION_TYPE |
In addition to the calculation types listed above, you can also determine the total number of data records. The result is displayed in the result row in the first available column. Because this setting affects the entire ALV output, you use methods of the interface class IF_SALV_WD_FIELD_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods for Displaying the Data Records of a Result
Function |
Method |
Display the number of data records |
SET_COUNT_RECORDS_ENABLED |
Check whether the number of data records is displayed |
IS_COUNT_RECORDS_ENABLED |
You are able to define whether you wish to display the result row for the calculations in an ALV output above or below the rows that are included in the calculation. You use the methods of the interface class IF_SALV_WD_FIELD_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods Relating to the Position of the Result Row
Function |
Method |
Place result row before data records |
SET_AGGR_BEFORE_ITEMS |
Check whether the result row is placed before the data records |
IS_AGGR_BEFORE_ITEMS |
By default, all fields with a numeric data type can be aggregated. You can forbid the aggregation of a field, if required. This has the following effects:
· The column in question is no longer available on the Calculation tab of the Settings dialog box.
· If you have defined an aggregation rule for this field in your application, the calculation is not carried out.
To forbid the aggregation of a field, use the methods of the interface class IF_SALV_WD_AGGR (implementing class CL_SALV_WD_FIELD).
Methods for Forbidding Aggregation
Function |
Method |
Forbid aggregation |
SET_AGGREGATION_ALLOWED |
Check whether aggregation is allowed |
IS_AGGREGATION_ALLOWED |