cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down list with two seprate values , one number and other one string.

Former Member
0 Kudos

Hi ,

I need to create a Dropdown list with two seprate values. The first value would be number and second value will be string. For example:

Values in Drop down: 00 Right Part object

01 Left part object

88 Ring structure.....

And so one, I have atleast 30 values. The issue is, what customer wants is, when user select some epecific row, only the number should be displayed not the string. So If use selects the last value in this example, only 88 should be visible.

But I am not sure, whether its possible in WDA drop down fucntionality?

Regards

PG

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi PG ,

To set value in dropdown you can follow the below code:-

DATA: LT_SECTIONS TYPE STANDARD TABLE OF WDR_CONTEXT_ATTR_VALUE,

LS_SECTIONS TYPE WDR_CONTEXT_ATTR_VALUE.

DATA: LR_NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO,

LR_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

LOOP AT IT_TABLE_NAME INTO WA_TABLE_NAME. " the table from which you are get the values to be set

LS_SECTIONS-VALUE = WA_TABLE_NAME-VALUE.

LS_SECTIONS-TEXT = 'Text to display'.

APPEND LS_VALUE TO LT_VALUE.

ENDLOOP.

LR_NODE = WD_CONTEXT->GET_CHILD_NODE( ' name of context node ').

LR_NODE_INFO = LR_NODE->GET_NODE_INFO( ).

LR_NODE_INFO->SET_ATTRIBUTE_VALUE_SET(

EXPORTING

NAME = 'ATTRIBUTE_NAME' "attribute name

VALUE_SET = LT_SECTIONS ).

Now in you can set values in LT_VALUE out side of the loop also. So if you are aware of the values to be display for user just set the text as per user choice . Whatever text you will set that will be displayed for the user where as the value can be different for in your program.

Regards,

Monishankar C

Former Member
0 Kudos

Have you considered ItemListBox UI element ?

Former Member
0 Kudos

Hi PG,

You can concatenate value and text. And then you can access value from the context. Here is some example code:

data: node_params type ref to if_wd_context_node_info,

lt_valueset type table of wdr_context_attr_value,

ls_valueset type wdr_context_attr_value.

node_params = wd_context->get_node_info( ).

node_params = node_params->get_child_node( 'PARAMS' ).

loop at lt_detail into ls_detil.

ls_valueset-value = ls_detail-dhkod.

ls_valueset-text = ls_detail-dhktx.

append ls_valueset to lt_valueset.

endloop.

node_params->set_attribute_value_set( name = 'DETAIL' value_set = lt_valueset ).