on 07-12-2011 11:54 AM
Hi Experts
I want to make the UI elements of my application dynamically read only on the basis of value in a flag. What will be the best way to achieve this? The layout is containing many input fields, all shud be made read only, if the flag is set.
Thanks in advance
Gaurav
Hi,
Create a Attribute in the type of boolean, and bind the attribute each field read only property.
in windows init method write set attribute for boolean field
ln_boolean->set_attribute( exporting name = 'BOOLEAN' value = abap_true ).
and search for the flag value
if that flag value came meams again write a query ln_boolean->set_attribute( exporting name = 'BOOLEAN' value = abap_false ).
Hope this helps,
Regards,
Srinivasan.R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gaurav,
Create one attribute of type WDY_BOOLEAN say READONLY and bind this to all input fields READ ONLY property.
Now in your action or event ( When you want to make all these fields to reaad only ).
If FLAG = 'X'.
* set single attribute
lo_el_existing->set_attribute(
name = ` READONLY `
value = ABAP_TRUE ).
endif.
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If all the fields depends on the same flag the solution of Srinivasan is Ok.
If not, Is not necessary to create an attribute for each UI element.
You can bind the property you want to its own property; in your case push the button "Define Context Element" of the property Read Only and choose the second radio-button: Bind to the property of the selected attribute: R Read Only
Then you can use this code in order to change this attribute dinamically:
CALL METHOD lo_el_your_element->set_attribute_property
EXPORTING
attribute_name = lv_att_name
property = 3 """""" Read Only; prop 1= visible, prop 2=required, prop 4= enabled
value = 'X'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.