cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable the input fields and labels.

Former Member
0 Kudos

Hi,

I have a requirement, when i click on button all the fields and labels in the form will be disable .

Accepted Solutions (0)

Answers (2)

Answers (2)

surajarafath
Contributor
0 Kudos

Create a New Attribute(say flag ) with type WDY_BOOLEAN . and bind this attribute to the enable property of the fields which you want to enable/disable.

And onaction button method. Set/Reset this by flag = 'X' or Space. and bind this attribute.

former_member184578
Active Contributor
0 Kudos

Hi,

For this you need to create an attribute in context of type wdy_boolean and bind the read only property of all the input fields and labels to the created attribute and in on action of the button set the attribute to true using set_attribute method of context element.

detailed:

Click on input field in the layout, under properties you can find read only, click on the binding button corresponding to read only and select the attribute which you created in context of type wdy_boolean.

in onAction button method,

set the attribute to 'X' or abap_true

Hope this helps u.,

Thanks & Regards,

Kiran.

Former Member
0 Kudos

Hi,

How to use set_attribute code to disable the input field.

Regards,

Ravi.

Former Member
0 Kudos

Hi,

You can call the set_attribute method from if_wd_context_element interface and pass the NAME and VALUE

of the attribute which is bound to the read only property of input field.

former_member184578
Active Contributor
0 Kudos

Hi,

You code wizard, in popup select set radio button and select the attribute and click on Ok, It will generate code automatically. Else find the below code

DATA lo_el_context TYPE REF TO if_wd_context_element.

lo_el_context = wd_context->get_element( ).

CALL METHOD lo_el_context->set_attribute

EXPORTING

name = `DISABLE` " Here disable is the name of attribute which u created in context of type wdy_boolean

value = 'X' .

Hope this helps u.,

Thanks & Regards,

Kiran.

Former Member
0 Kudos

Hi,

i get the error as 'Could not find attribute DISABLE' but i create the attribute disable . If possible please give the clear step by step process.

Former Member
0 Kudos

Hi,

Have you declared DISABLE attribute in your context?? and also check the spelling, it may be a typo.