Register Login

Percentage Totals in ALV

Updated May 18, 2018

The percentage can be displayed using a small technique. While peforming the Field catalog, populate the field DO_SUM = 'C'. This will give the output as the Percentage(Mean). This will work only for amount or numeric fields.

Eg: Perform: format_field_catalog
using 'Total Amount' 'I_ALVTAB' '8' ' ' 'C' G_FIELDCAT[].

Here I_ALVTAB is the internal table where the data has been stored.
'8' is the column position.
G_FIELDCAT[] type slis_t_fieldcat_alv.

FORM format_field_catalog USING P1
P2
P3
P4
P5
P_G_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

STATICS: L_LT_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV.

CLEAR: L_LT_FIELDCATALOG.

L_LT_FIELDCATALOG-FIELDNAME = P1.
L_LT_FIELDCATALOG-TABNAME = P2.
L_LT_FIELDCATALOG-COL_POS = P3.
L_LT_FIELDCATALOG-KEY = P4.
L_LT_FIELDCATALOG-DO_SUM = P5.

APPEND L_LT_FIELDCATALOG TO P_G_FIELDCAT.

ENDFORM. " format_field_catalog


×