cancel
Showing results for 
Search instead for 
Did you mean: 

How to make UI Element visible after triggering the Event

ChandraMahajan
Active Contributor
0 Kudos

Hi All,

i am developing WDA application. i have requirement as when user will select the option from dropdown box (Cust type) and if it is B (say Business) then and then only i have to show two inputboxes. and if again he chooses anothe option i have to make them invisible. do i need to use Invisble UIelement? could you please help me regarding this problem.

Thanks in advance.

Chandra.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi.

Another way would be to bind the visible property of these inputfields to a context

attribute of type WDUI_VISIBILITY.

In your action handler you would just set this attribute to 1 for invisible or 2 for

visible in the context regarding the selected value of the dropdown box.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

ChandraMahajan
Active Contributor
0 Kudos

Hello,

apart from mentioned code do we have to do any changes in wdmodifyview?

beacuse i have taken attribute of type WDUI_VISIBILITY and set it to values accordingly but not getting the desired result?

Regards,

Chandra

Former Member
0 Kudos

Hi,

METHOD wddomodifyview .

IF first_time IS not INITIAL.

wd_this->m_view = view.

wd_this->set_views( ).

ENDIF.

ENDMETHOD.

this in wddomodifyview,

the two solutions are totally different, so for my part no wdy_visibility necessary,

the one of sacha needs that

grtz

Koen

Former Member
0 Kudos

Hi Chandra.

Did you bind the property 'visible' of your ui elements to the context attribute of type WDUI_VISIBILITY you use?

Cheers,

Sascha

ChandraMahajan
Active Contributor
0 Kudos

yes i have bind the proprty.

Former Member
0 Kudos

Could you post the code of you action handler method of the drop down list?

ChandraMahajan
Active Contributor
0 Kudos

Hi Below is the code,

method ONACTIONDISPLAY_BUSINESS .

DATA:

node_cust_type TYPE REF TO if_wd_context_node,

elem_cust_type TYPE REF TO if_wd_context_element,

stru_cust_type TYPE if_customerview=>element_cust_type .

  • navigate from <CONTEXT> to <CUST_TYPE> via lead selection

node_cust_type = wd_context->get_child_node( name = if_customerview=>wdctx_cust_type ).

  • get element via lead selection

elem_cust_type = node_cust_type->get_element( ).

  • get all declared attributes

elem_cust_type->get_static_attributes(

IMPORTING

static_attributes = stru_cust_type ).

DATA:

elem_context TYPE REF TO if_wd_context_element,

stru_context TYPE if_customerview=>element_context ,

item_business_name1 LIKE stru_context-business_name1.

"type WDUI_VISIBILITY

  • get element via lead selection

elem_context = wd_context->get_element( ).

  • get single attribute

elem_context->get_attribute(

EXPORTING

name = `BUSINESS_NAME1`

IMPORTING

value = item_business_name1 ).

case stru_cust_type-value. "Value of the Dropdown

when 'B'. "Business then Show

item_business_name1 = 02.

when 'I'. "else do not show

item_business_name1 = 01.

endcase.

endmethod.

Former Member
0 Kudos

Hi Chandra.

item_business_name1 is of type WDUI_VISIBILITY?

Then you just forgot to set it back to the context.

You have to call:


elem_context->set_attribute(
EXPORTING
name = `BUSINESS_NAME1`
value = item_business_name1 ).

after you have set the attribute in your case block.

Cheers.

Sascha

ChandraMahajan
Active Contributor
0 Kudos

Hi Sascha,

you r right!! i just forgot to set it back. now its working fine.

Thanks for your help.

Regards,

Chandra

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

you should design the layout with the two inputfields, but with the attribute visible on false.

when you have your event, you can handle it like this:

first of all get your instance of the view in wddomodifyview as an attribute

in the action handler, get the static attributes:

selected_element_dropdown = wd_event->get_context_element( 'CONTEXT_ELEMENT' ).

selected_element_dropdown->get_static_attributes( importing static_attributes = ls_structure ).

case ls_structure-key.

when 'needs to be visible'.

lo_inputfield = wd_this->m_view->get_element( 'is fof inputfield' ).

lo_inputfield->set_visible( abap_true ).

when 'needs to be hidden'.

lo_inputfield = wd_this->m_view->get_element( 'is fof inputfield' ).

lo_inputfield->set_visible( abap_false ).

endcase.

grtz

Koen

ChandraMahajan
Active Contributor
0 Kudos

Hello Koen,

thanks for your reply.

but how to get the instance of view in wdmodifyview?

Chandra

Former Member
0 Kudos

Hi,

in wddomodifyview is it an importing parameter view

bind it to the general attributes

do this only is it is the first entry in the page (also an importing parameter)

grtz

Koen