cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable a button ?

Former Member
0 Kudos

Hi ,

what is the code to disable a button? I want to write a code in the event of button, in order to disable a button.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

bind the ENABLE property of ur button to a context attribute of type WDY_BOOLEAN . Inside ur method, set the context attribute using SET_ATTRIBUTE METHOD , code wizard(control+f7) to ' '(blank) for disable and 'X' for enable of the button.

regards,

Amit

Answers (2)

Answers (2)

Former Member
0 Kudos

hi..

I am not very clear with your requirement..er...

However, in order to disable the button, at least you have 2 ways:

(1).Use Context Attribute bound to the Button

This attribute has type "Char1" or "abap_boolean", which will be bound to the "Enable" property of button.

Enable the button:

set the attribute  =   'X'.

Disable the button:

set the attribute  =   ' '.

(2).Use the CL_WD_BUTTON runtime class.

At runtime you can disable it. But you should use the "view" parameter..For example in the WDmodifyView method (or you can save the "VIEW" as a virable in WDModifyView):

you can


    lo_button = view->get_element( 'BUTTON' ).
    lo_button->SET_ENABLED

Best wishes.

Former Member
0 Kudos

Hi,

it might be a better idea to bind the attribute 'enabled' to a context attribute of type wdy_boolean

and then change the value of the context attribute.

Greetz,

Koen