Skip to Content
avatar image
Former Member

Disabling button during runtime.

Hello All,

On clicking of a button there is some processing going on. I have a requirement in which I need to disable a button whenever a processing is going on and enable it back once the processing is complete.

I have used a flag. Whenever the button is clicked, I am setting the flag as 1 and calling a method. In this method, I am setting the value of context at abap_false. Once the processing is complete, I am setting the flag as 0 and  calling the method again. This time I am setting the value of context as abap_true.

I have bind that context to the button.

I am unable to see the enabling and disabling of the button.

Please advice me on this.

Regards,

Neha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Mar 22, 2013 at 04:38 AM

    Hi Neha,

    As I can see you have changed the value of FLAG correctly but the button will not get disabled until you trigger some event. Value of flag is changes but no event is triggered so that changes reflect on frontend.

    Try to raise some event and enable/disable button based on the FLAG in that event.

    Hope this helps you.

    -Manish

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Case 1: IF your changing the view of a button you should change it in WDDOMODIFYVIEW method in the views component.

      Note: This method will be triggered many time when ever your trying to do the action. So you have to validate the status of your process before enabling or disabling the button. If you do that it will work perfectly fine.

      Case 2: If your trying to change the view of a button in ALV you have to write a method in component controller and trigger that one in WDDOMODIFYVIEW method.

      Regards,

      Arunkumar.

  • Mar 22, 2013 at 06:02 AM

    Hi Neha,

    Please create a node in the context of the concerned view. Under that node create an attribute 'visible' (example) of type WDUI_VISIBILITY.

    Go to the layout, bind this attribute to the Visible property of the button.


    In my case I had another button, clicking on which the hidden button will be displayed.

    So in the event created for this button I put the following logic.

        DATA lo_nd_visibility TYPE REF TO if_wd_context_node.

        DATA lo_el_visibility TYPE REF TO if_wd_context_element.

        DATA ls_visibility TYPE wd_this->element_visibility.

      navigate from <CONTEXT> to <VISIBILITY> via lead selection

        lo_nd_visibility = wd_context->get_child_node( name = wd_this->wdctx_visibility ).

      get element via lead selection

        lo_el_visibility = lo_nd_visibility->get_element(  ).

      get all declared attributes

        lo_el_visibility->get_static_attributes(

          IMPORTING

            static_attributes = ls_visibility ).

    CALL METHOD lo_nd_visibility->set_attribute

        EXPORTING

          value  = '02'

          name   = 'VISIBLE' .

    I hope this will be helpful for you.

    Regards,

    Gourav

      wd_this->fire_to_main_plg(

      ).

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 22, 2013 at 05:30 AM

    Hi Neha,

    What i was assuming is you have written  the logic to disable the button and enable the button in the same event handler method. If that is the case  the changes will not reflect on the front end. After the execution of event the screen will be rendered again by executing the domodifyveiw method. I was just assuming that you might have written the code for enabling and disabling in the same method..Why dont you post some code or screen shot.. it may help us understand your problem better.

    Best Regards,

    Arun Krishnamoorthy

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 22, 2013 at 06:11 AM

    Hi,

    To which property have you binded?

    You need to bind the attribute with type WDY_BOOLEAN to enable property of button.In the button action method you have to disable by selecting set radio button from code wizard when the process is going on.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 22, 2013 at 08:38 AM

    Hi,

    Have you mapped as shown below, This scenario works properly for me

    Here i am making the field non editable once update has been done using below method

    set_attribute(

           name =  `IS_ENABLE`
           value = lv_is_enable ).


    lv_is_enable = space OR 'X'.

    Add comment
    10|10000 characters needed characters exceeded