cancel
Showing results for 
Search instead for 
Did you mean: 

Percentage for aggregated fields in Web dynpro abap ALV

Former Member
0 Kudos

Hi All,

I need to have percentage value for the aggregated fields in Web dynpro ALV.Is it possible to achieve the same in ALV or Not?

For ex:

                         Col1               Col2            Col3(%)

                          100                 10              10(Col2 / Col1 ) * 100

                           200                10               5

Grand Total          300                 20              6.67

the above functinality i need through Web dynpro ALV.

Please not i have used the aggregation rule for achieving the Grand total and sub total.but i'm not able to get the % for the same.

Is there any method or class using which i can obtain the results.

Regards.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi  Kwaja Khan,

I'm not entirely sure what you want to do, but to show rows with totals You can do the following:

  DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

  DATA lv_value TYPE REF TO cl_salv_wd_config_table.

  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.

  "Instantiate your component alv

  lo_cmp_usage =   wd_this->wd_cpuse_alv_( ).

  IF lo_cmp_usage->has_active_component( ) IS INITIAL.

    lo_cmp_usage->create_component( ).

  ENDIF.

  "Get the model

  lo_interfacecontroller =   wd_this->wd_cpifc_alv_( ).

  lv_value = lo_interfacecontroller->get_model( ).

  "Active funcions

  cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(

      r_model =  lv_value

      allowed = abap_true ).

Then, when you display your alv:

Click the link options, then in the calculation tab, select the option you want and press ok. A new row will be added to the total calculation

Former Member
0 Kudos

Hi Hermoso,

My requirement is following:

suppose there are 5 columns and i am sorting the values and getting the subtotal and total based on first 3 column.Till now to obtain this i have the aggregate rule and sort with the help of it i can achieve this.

but there is a column no 6(for ex.) which takes the percentage of ( column4 /column 5 ) * 100 and displayed in column 6.In the subtotals and Grand total i need the percentage calculated in the same manner i.e.

(subtotal of column 4 / subtotal of column 5 ) * 100 and the value needs to be shown in column 6.