cancel
Showing results for 
Search instead for 
Did you mean: 

Disable and enable ALV row selection based on condition

Former Member
0 Kudos

Dear Experts,

Can anyone let me know how to disable and enable entire ALV row selection?.

The scenario is : By default i need to disable entire row selection of ALV and based on condition,i need to enable it.

Thanks

Katrice

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Katrice,

You can control this with methods SET_ROW_SELECTABLE and SET_SELECTION_MODE of interface IF_SALV_WD_TABLE_SETTINGS. You only need to call one or the other method, not both. Each method has a slightly different effect. SET_SELECTION_MODE will show or hide the selection column and SET_ROW_SELECTABLE will always show the selection column but will enable or disable the buttons.

   DATA lo_cmp_usage           TYPE REF TO if_wd_component_usage.
   DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
   DATA lo_model                    TYPE REF TO cl_salv_wd_config_table.
   DATA lo_settings                 TYPE REF TO if_salv_wd_table_settings.

* -- Instantiate the ALV used component

   lo_cmp_usage = wd_this->wd_cpuse_alv_table( ).

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

* -- Get ALV model

   lo_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
   lo_model = lo_interfacecontroller->get_model( ).

* -- Enable or disable row selection

   lo_settings = lo_model->if_salv_wd_view_settings~get_table_settings( ).

   lo_settings->set_row_selectable( abap_false ).    " or call...
   lo_settings->set_selection_mode( cl_wd_table=>e_selection_mode-none ).

And re-enable row selection with

   lo_settings->set_row_selectable( abap_true ).    " or call...
   lo_settings->set_selection_mode( cl_wd_table=>e_selection_mode-auto ).


Cheers,

Amy

Former Member
0 Kudos

Thanks Amy,

My issue resolved.Appreciate you help.

Thanks

Katrice

Former Member
0 Kudos

Hi Amy,

When i tried what you have mentioned the above code. I got  an error like "

Class "CL_SALV_WD_CONFIG_TABLE" does not contain an interface

"IF_SALV_WD_VIEW_SETTINGS".

I could not able to find IF_SALV_wd_view_settings.

Thanks

Vijay

amy_king
Active Contributor
0 Kudos

Hi Vijay,

What NetWeaver release are you on? It's possible you are on an older release that doesn't have the interface added to CL_SALV_WD_CONFIG_TABLE. I wasn't able to find in what release this interface was added to CL_SALV_WD_CONFIG_TABLE, but I am on NetWeaver 7.0 EhP2.

Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

Thanks for your answer.

Yes i am using a older version,  Netweaver 7.0 EHP1.

Thanks

Vijay

Answers (0)