Skip to Content
author's profile photo Former Member
Former Member

Enable/Disable button on ALV cell

Hi All,

Field1 Field2 Field3 Plant1 1000938394 Button1 Plant2 1000938395 Button2 Plant3 1000938396 Button3

I'm displaying data in Web Dynpro Abap, ALV in above show way. I want to Enable/Disable or hide/unhide buttons on the Field3 based on some conditions. I'm new to Web Dynpro, could anyone help me on how can i achieve this in Web Dynpro ALV. I searched online but couldn't find anything related to this.

Thanks in Advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jan 06, 2014 at 05:23 PM


    Create an attribute (say enable_button) of type wdy_boolean in the context node and then use set_enabled_fieldname( ) method of cl_salv_wd_uie_button.

    Write the below code in WDDOINT method.

    DATA: lr_cmp_usage TYPE REF TO if_wd_component_usage,

    lr_intf_ctrl TYPE REF TO iwci_salv_wd_table,

    lr_model TYPE REF TO cl_salv_wd_config_table,

    lr_column TYPE REF TO cl_salv_wd_column,

    lr_button TYPE REF TO cl_salv_wd_uie_button.

    lr_cmp_usage = wd_this->wd_cpuse_alv( ). " ALV is the name of Component usage

    IF lr_cmp_usage->has_active_component( ) IS INITIAL.

    lr_cmp_usage->create_component( ).


    lr_intf_ctrl = wd_this->wd_cpifc_alv( ).

    lr_model = lr_intf_ctrl->get_model( ).

    *Get Column to change cell editor to button

    lr_column = lr_model->if_salv_wd_column_settings~get_column( 'FIELD3' ). " Field3 is the name of column

    *Create button UI element and set as editor to the column Field3

    CREATE OBJECT lr_button.

    lr_button->set_text( 'Button Text' ).

    lr_button->set_enabled_fieldname( 'ENABLE_BUTTON' ).

    lr_column->set_cell_editor( lr_button ).

    Then loop your table data and based on condition set the attribute 'enable_button' to abap_true/ abap_false.

    Hope this helps u,



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.