cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP DROP_DOWN_BY_KEY

Former Member
0 Kudos

Hello all,

I've looked around and did not see an example of the following.

I have a DROP_DOWN_BY_KEY and have an action for that.

I need to get selected value and depending on that value have another element (input field) become visible.

I have these elements on the screen. One of them is hidden.

In my onaction method I have something like this:

element = wd_context->get_lead_selection( ).

which gets me selected element.

My question is how to check what element value is. I am not sure what type of object I get after I call get_lead_selection( )

Thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

srinivasa_raghavachar
Participant
0 Kudos

Hi George,

Once you have populated the dropdownby key, getting the selected value by the user should be similar to getting the value of any attribute.

Example:

element->get_attribute(

EXPORTING

name = `DROPDOWN`

IMPORTING

value = item_dropdown ).

'DROPDOWN' is the name of teh context attribute mapped to the drop down box.

Regards,

Srini.

Former Member
0 Kudos

Hello Srini,

thanks for your reply.

what object type does this method return?

Once I get it I need to compare it to a string such as

IF selectedValue EQ 'dummy'

display element

To display a hidden element I need to be able to get a reference to it and set its attribute to visible. How can I achieve this?

Thank you.

srinivasa_raghavachar
Participant
0 Kudos

Hi Georgy,

I assume you have already populated dropdown with list of possible values to select and you just want to retreive the value selected by the user and use it in your code.

1) Assume your node name is Test and the attribute in Test which you have bound to dropdownbox is 'DROPDOWN'.

2) Use the following code:

DATA: context_node TYPE REF TO if_wd_context_node,

elem_test TYPE REF TO if_wd_context_element,

stru_test TYPE if_componentcontroller=>element_test ,

item_dropdown LIKE stru_test-dropdown.

elem_flightinfo->get_attribute(

EXPORTING

name = `DROPDOWN`

IMPORTING

value = item_dropdown ).

Now you can use item_dropdown to make a comparison:

To set display the hidden element, use an attribute say yesorno in the context node:

Then set this attribute based on the value of item_dropdown.

IF item_dropdown EQ 'dummy'

elem_flightinfo->set_attribute(

EXPORTING

name = `YESORNO`

value = 'visibiltyproperty(Use the correct value based on property)').

endif.

Now set this attribute for the visibility property of the UI element which you have hided.

Regards,

Srini.

item_connid LIKE stru_flightinfo-connid,

item_fldate like stru_flightinfo-fldate,

item_planetype like stru_flightinfo-fldate,

Former Member
0 Kudos

Hello Srini,

thanks!