cancel
Showing results for 
Search instead for 
Did you mean: 

Add list Entries in "Drop down list by Key"

Former Member
0 Kudos

Hi experts ,

i want to create a drop down list by key, i don't know how to assign values to it ( i.e. add list entries ) . Please help me on this ..

With regards ,

James..

Valuable answers will be rewarded ....

Accepted Solutions (1)

Accepted Solutions (1)

former_member215843
Active Participant
0 Kudos

Hi James,

  data: l_node         type ref to if_wd_context_node,
        l_node_info    type ref to if_wd_context_node_info,
        l_value_set    type wdr_context_attr_value_list,
        wa_value_set   like line of l_value_set.

  l_node = wd_context->get_child_node( 'MSG_TYPE' ).
  l_node_info = l_node->get_node_info( ).

*-- loop --
  wa_value_set-text  = 'Test1'.
  wa_value_set-value = 'KEY1'.
  insert wa_value_set into table l_value_set.
* -- endloop --
  l_node_info->set_attribute_value_set(
          name      = 'MY_ATTRIBUTE'
          value_set = l_value_set ).

Ciao, Regina

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi James.

Just for more info:

If you bind an attribute to the "drop down by key list" which has a value set defined at domain level, the values are populated automatically. Nothing else to do in this case.

Cheers,

Sascha

Madhu2004
Active Contributor
0 Kudos

hai james,

i have sample code in which i populated the values of carrid in dropdownby key,check it out .

<i><u><b>code is as follows:</b></u></i>

DATA:

node_flight TYPE REF TO if_wd_context_node,

elem_flight TYPE REF TO if_wd_context_element,

stru_flight TYPE if_inputview=>element_flight,

nodeinfo_flight type ref to if_wd_context_node_info,

it_valueset type table of wdr_context_attr_value,

it_scarr type table of scarr,

wa_scarr like line of it_scarr,

wa_valueset like line of it_valueset.

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

node_flight = wd_context->get_child_node( name = if_inputview=>wdctx_flight ).

nodeinfo_flight = node_flight->get_node_info( ).

CALL METHOD cl_abapwd_flight_model=>get_airlines

receiving

l_scarr = it_scarr

.

loop at it_scarr into wa_scarr.

wa_valueset-value = wa_scarr-carrid.

wa_valueset-text = wa_scarr-url.

append wa_valueset to it_valueset.

endloop.

nodeinfo_flight->set_attribute_value_set(

name = 'CARRID'

value_set = it_valueset ).