cancel
Showing results for 
Search instead for 
Did you mean: 

how to disable UI element during runtime

Former Member
0 Kudos

Hi!

Can someone show me how to access the properties of ui elements during runtime?

eg. in the method WDDOINIT i want to enable/disable the GroupBox "Group"

how to?

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

anyway, this way works... thanks Abhi

Its just hard for me to get familier with all the classes here.

Thats why i would like to now how i can change properties of a UI Elements in general during runtime... Which class do i have to use and so on..

abhimanyu_lagishetti7
Active Contributor
0 Kudos

ideal way is the one i specified,

other way is you have to change it in WDDOMODIFYVIEW

to get any UI element this is the code

view->get_element( '<ID of the UI element>' ). which return the corresponding UI element reference

the UI element classes start with CL_WD_*.

for example: inputfield CL_WD_INPUT_FIELD

data: lr_input type ref to cl_wd_input_field.

lr_input ?= view->get_element( '<ID of the UI element>' ).

lr_input->set_enable( abap_true ).

Abhi

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> ideal way is the one i specified,

>

> other way is you have to change it in WDDOMODIFYVIEW

>

> to get any UI element this is the code

>

> view->get_element( '<ID of the UI element>' ). which return the corresponding UI element reference

>

> the UI element classes start with CL_WD_*.

>

> for example: inputfield CL_WD_INPUT_FIELD

> data: lr_input type ref to cl_wd_input_field.

> lr_input ?= view->get_element( '<ID of the UI element>' ).

> lr_input->set_enable( abap_true ).

>

> Abhi

I would like to stress that this NOT the SAP recommended way of controlling the properties on UI elements - the first solution you were give would be the recommended approach. The direct UI coding access should be used as a last resort when working with dynamically generated UI elements. Otherwise you should always try and set the UI element properties via context binding. This makes your application more accessible to customizing/personalization, makes it easier to maintain over time and provides the best performance.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Yes Thomas

I remember, you mentioned this point earlier also.

Thanks

Abhi

Answers (2)

Answers (2)

Former Member
0 Kudos

Is there a other way to access the properties directly?

actually i want to use ENABLED true/false and not visible?

abhimanyu_lagishetti7
Active Contributor
0 Kudos

for doing it in WDDOINIT, you can directly change the visible property to none.

nyways here is the procedure

1. create a context attribute of type WDUI_VISIBILITY

2. bind it with the visible property of the UI element

3. code to set the attribute with appropriate value

to disable

wd_cotnext->set_attribute( name = '<attrib_name>' value = if_wdl_core=>visibility_none ).

to enable

wd_context->set_attribute( name = '<attrib_name>' value = if_wdl_core=>visibility_visible ).

Abhi