cancel
Showing results for 
Search instead for 
Did you mean: 

How can i give the hard coded values to drop down list?

Former Member
0 Kudos

Hi All.

In my screen i have a drop down field .to this i have to give the hard coded values .and selected value is the input for me to get the data from the backend.

How can i give the hard coded values to that field & how can i get the selected value into that.........

Plz help me to resolve this.......

Regards,

ravi

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

DATA: lr_node type ref to if_wd_context_node.

data: lr_info type ref to if_wd_context_node_info.

data: lt_valueset type WDR_CONTEXT_ATTR_VALUE_LISTGEN.

data: ls_valueset type line of WDR_CONTEXT_ATTR_VALUE_LISTGEN.

ls_valueset-value = '1'.

ls_valueset-text = 'first option'.

append ls_valueset to lt_valueset.

ls_valueset-value = '2'.

ls_valueset-text = 'second option'.

append ls_valueset to lt_valueset.

lr_node = wd_context->get_child_node( '<Attribute node which is binded to Dropdown' ).

lr_info = lr_node->get_node_info( ).

lr_info->SET_ATTRIBUTE_VALUE_SET( name = '<attribute name binded to dropdown>'

value_set = lt_valueset ).

Abhi

Former Member
0 Kudos

Hi Abhi,

when i m using above code it throwing error like "WDR_CONTEXT_ATTR_VALUE_LISTGEN" is generic type.a type reference is only possible for field symbols & Formal Parameters.

How can i resolve this,

Regards,

Ravi

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I wouldn't use WDR_CONTEXT_ATTR_VALUE_LISTGEN. Use wdr_context_attr_value_list instead:

data l_topics type zpm_main_topic_tbl.
  l_topics = wd_assist->read_all_topics( ).

  data lt_valueset type wdr_context_attr_value_list.
  field-symbols <wa_topic> like line of l_topics.
  field-symbols <wa_vs>  like line of lt_valueset.

  loop at l_topics assigning <wa_topic>.
    append initial line to lt_valueset assigning <wa_vs>.
    <wa_vs>-value = <wa_topic>-main_topic.
    <wa_vs>-text  = <wa_topic>-main_topic_desc.
  endloop.

  data lo_nd_meeting type ref to if_wd_context_node.
* navigate from <CONTEXT> to <MEETING> via lead selection
  lo_nd_meeting = wd_context->get_child_node( name = wd_this->wdctx_meeting ).
  data lo_node_info type ref to if_wd_context_node_info.
  lo_node_info = lo_nd_meeting->get_node_info( ).
  lo_node_info->set_attribute_value_set(
     name = 'MAIN_TOPIC'
     value_set = lt_valueset ).

Answers (0)