cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ALV grid totals

Former Member
0 Kudos

Hi,

I have created an application that uses a web dynpro alv grid. I want to display totals - is there a setting that can do this automatically - if so, can you please tell me how to do this? Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Refer this link for my reply-

Regards,

Lekha.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

You can take help of following code snippet to create totals for a particular column

Data: lr_function_settings TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
  DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
        lr_column          TYPE REF TO cl_salv_wd_column,
        lt_column type salv_wd_t_column_ref,
        ls_column type salv_wd_s_column_ref.
Data:  lr_field_amnt type REF TO CL_SALV_WD_FIELD.
 
* get reference of ALV component
  lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
  wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
 
*  get function settings
  lr_function_settings ?= wd_this->alv_config_table.
 
* display columns in correct order
  lr_column_settings ?= wd_this->alv_config_table.
 
  lt_column = lr_column_settings->get_columns( ).
 
 
  loop at lt_column into ls_column.
 
CASE ls_column-id.
when 'AMOUNT'
* aggregate field
        CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD
          EXPORTING
            FIELDNAME = 'AMOUNT'
          RECEIVING
            VALUE     = lr_field_amnt.
 
* create aggregate rule as total
        CALL METHOD LR_FIELD_AMNT->IF_SALV_WD_AGGR~CREATE_AGGR_RULE
          EXPORTING
            AGGREGATION_TYPE = IF_SALV_WD_C_AGGREGATION=>AGGRTYPE_TOTAL
          RECEIVING
            VALUE            = lv_aggr_rule.
 
endcase.

Regards

Manas DUa