cancel
Showing results for 
Search instead for 
Did you mean: 

how to define the texts for UI element Dropdownlistbykey?

Former Member
0 Kudos

Hi everyone,

I don't know how to define the texts for Dropdownlistbykey. It seems that Dropdownlistbykey has an attribute "selected key", but where can I bind the texts I want to display when user clicks the downwards

arrow?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

arjun_thakur
Active Contributor
0 Kudos

Aaron,

The values of drop down by key are populated with the help of value set. In that we pass the key and value of the item which is displayed in the drop down list. So when we expand the drop down list we see the value of the items and when we select any item, its key gets selected.

Refer the code (for drop down by key) given bt saurav in thread: .

I hope it helps.

Regards

Arjun

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

To display the values in the dropdownbyKey, bind the field with an attribute based on the DDIC domain.

It will display the values maintained in the domain level. If you want to add more valued in the runtime

maintain a table like this

value_set_item-key = 'X'.

value_set_item-value = 'Charter'.

insert value_set_item into table lt_value_set.

You have to maintain both key and value and upload the table to your attribute like

lr_node_info->set_attribute_value_set( NAME = "attribute name" VALUE_SET = table name).

Hope this help you

Regards,

Naresh

former_member402443
Contributor
0 Kudos

Hi ,

Check the Standard Component WDR_TEST_EVENTS for the dropdownbykey.

Hopes this will helps you.

Regard

Manoj Kumar

Former Member
0 Kudos

hi,

you can use this code :

method WDDOINIT .

DATA : node_info TYPE REF TO if_wd_context_node_info,

value1 TYPE wdy_key_value,

set TYPE wdy_key_value_table,

k1 type string value 'M',

v1 type string value 'MAGO',

k2 type string value 'S',

v2 type string value 'Saurav'.

*

value1-key = k1.

value1-value = v1.

APPEND value1 to set.

value1-key = k2.

value1-value = v2.

APPEND value1 to set.

node_info = wd_context->get_node_info( ).

node_info = node_info->get_child_node('FOR_DROP').

node_info->set_attribute_value_set( name = 'DROP_KEY' value_set = set ).

I hope it helps.

Thanx.