How to do Aggregation using the class CL_SALV_AGGREGATION

The column of the ALV Display can be aggregated using the add_aggregation( ) method of the class CL_SALV_AGGREGATION.

DATA lr_salv_aggregation TYPE REF TO cl_salv_aggregation.

Lr_salv_aggregation = lr_salv_table=>get_aggregations( ).

Lr_salv_aggregation->set_aggregation_before_items( abap_true ).

Lr_salv_aggregation->add_aggregation( columnname = ‘AGE’

                                                                aggregation  =  if_salv_c_aggregation=>average ).

The following aggregation types are available.

If_salv_c_aggregation=>minimum.

If_salv_c_aggregation=>maximum.

If_salv_c_aggregation=>average.

If_salv_c_aggregation=>total.

If_salv_c_aggregation=>none.