cancel
Showing results for 
Search instead for 
Did you mean: 

Error in ALV Total

former_member205842
Participant
0 Kudos

Hi Experts,

                 Am trying to add total for alv webdynpro column (WEIGHTAGE_RATING) but am not able to display total in my screen.

DATA: lo_cmp_usage TYPE REF TO if_wd_component_usage.
   DATA: lr_salv_wd_table  TYPE  REF  TO  iwci_salv_wd_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_function_settings  TYPE  REF  TO  cl_salv_wd_config_table.
   DATA: lr_field_settings  TYPE  REF  TO  if_salv_wd_field_settings,
         lr_field_amnt  TYPE  REF  TO  cl_salv_wd_field.
   DATA: lv_aggr_rule  TYPE  REF  TO  cl_salv_wd_aggr_rule.
   DATA: lr_sort_rule  TYPE  REF  TO  cl_salv_wd_sort_rule.

   lo_cmp_usage =   wd_this->wd_cpuse_alv_table( ).
   IF lo_cmp_usage->has_active_component( ) IS INITIAL.
     lo_cmp_usage->create_component( ).
   ENDIF.


   lr_salv_wd_table = wd_this->wd_cpifc_alv_table( ).
   lr_function_settings = lr_salv_wd_table->get_model( ).
* get reference to column settings
   lr_column_settings ?= lr_function_settings.
* get all columns
   lt_column = lr_column_settings->get_columns( ).

   lr_field_settings ?= wd_this->r_table.

   LOOP AT lt_column INTO ls_column.
     CASE ls_column-id.
       WHEN 'WEIGHTAGE_RATING'.
         CALL METHOD lr_function_settings->if_salv_wd_field_settings~get_field
           EXPORTING
             fieldname = 'WEIGHTAGE_RATING'
           RECEIVING
             value     = lr_field_amnt.

         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.
   ENDLOOP.

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Syed,

The code looks fine. Make sure that the type of field 'WEIGHTAGE_RATING' is not of type character.

It should be of type decimal or integer or quantity or amount. If not, please change the type of the field accordingly.

Hope this helps you.

Regards,

Rama

former_member205842
Participant
0 Kudos

Hi Ram,

Thanks for help it help me alot...

ramakrishnappa
Active Contributor
0 Kudos

You are welcome.

Answers (1)

Answers (1)

Former Member
0 Kudos