cancel
Showing results for 
Search instead for 
Did you mean: 

Set visibility attribute of an Input field.

Former Member
0 Kudos

Hi all,

I need to set visibility of an input field only if I select a specific value in another input field with dropdown list. I check this code:

lo_el_uielement_cont ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lo_el_group ?= lo_el_uielement_cont->get_child( id = 'GRUPPO_RICERCA' ).

lo_el_date_from ?= lo_el_group->get_child( id = 'DATE_FROM' ).

lo_el_date_from->set_visible( value = '02' ).

lo_el_date_from->set_enabled( value = 'X' ).

If works only in the method WDDOMODIFYVIEW but in the method connected on the action "on select" of the dropdown input field it doesn't works because there isn't the object view.

It is possible to modify the layout attributes of the element of a webdynpro without binding it to an attribute of the context?

Regards,

Norberto.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

>

> Hi all,

> I need to set visibility of an input field only if I select a specific value in another input field with dropdown list. I check this code:

>

>

> If works only in the method wddomodify but in the method connected on the action "on select" of the dropdown input field it doesn't works because there isn't the object view.

>

> It is possible to modify the layout attributes of the element of a webdynpro without binding it to an attribute of the context?

>

> Regards,

> Norberto.

Hi,

Why are you not want to do that with context binding ?.

doing it on wddomodify method is an expensive way.

I would bind the visibility property to an attribute or event a better to bind the attribute property-visibile itself.

Neverthless if you like to do it on your way then

create a attribute

GO_view type if_wd-view.

in wddomodify assign the view refrence

if first_time( ) = abap_true.

go_view = view.

endif.

move your original logic to a new method like below

lo_el_uielement_cont ?= wd-this->go_view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lo_el_group ?= lo_el_uielement_cont->get_child( id = 'GRUPPO_RICERCA' ).

lo_el_date_from ?= lo_el_group->get_child( id = 'DATE_FROM' ).

lo_el_date_from->set_visible( value = '02' ).

lo_el_date_from->set_enabled( value = 'X' ).

By this way you can call this method from other method in this view.

Former Member
0 Kudos

Hi Baskaran,

I try to set the visibility of the element without bind an attribute to the property because I need to set this property only at initialization of the view and when I select a specific value of a dropdown list. I think it is "unusual", even though it is the standard behaviour for webdynpro, to set another attribute if the behaviour of the visibility depend on the value I set in the dropdown list: it is a redundancy.

Another way to solve this issue could be to implement a void method for the onSelect Events, this force the web dynpro to execute, every time I select a value from the dropdown list, the method WDDOMODIFYVIEW.

Comparing two similar webdynpro in this way the change of the layout is faster than setting an attribute binding to visibility property.

Regards,

Norberto.

Former Member
0 Kudos

>

> Comparing two similar webdynpro in this way the change of the layout is faster than setting an attribute binding to visibility property.

>

> Regards,

> Norberto.

Hi Norberto,

It is not unusual, most of us use to choose the first option of defining a extra attribute to control the property of the UI. i am not sure if one option is faster than the other.

The only difference i see is defining an extra attribute further you still need to do a UI property binding, you need to set the value accordingly to the binded attribute.

Cheers.

Answers (1)

Answers (1)

Former Member
0 Kudos

http://wiki.sdn.sap.com/wiki/display/WDABAP/SetvisibilityofbuttondynamicallyinWebDnproABAP

This Can help you .

Former Member
0 Kudos

Hi,

thanks for all answers. I solved my problem without binding an attribute to the properties. I set the visibility with the metod WDDOMODIFYVIEW: I set this attribute only at the start of the webdynpro and when I select a specific value of the dropdownlist, so I think it is redundant to set another attribute. I note that, but I'll verify better, this way result in a faster update of the screen.

Best regards,

Norberto