cancel
Showing results for 
Search instead for 
Did you mean: 

Default value in drop down by Key

Former Member
0 Kudos

Hi experts,

I need to get the default value in my drop down. i am using drop down by key. I am using the below code to populate the drop down.

DATA : node_info TYPE REF TO if_wd_context_node_info.

DATA : value TYPE wdr_context_attr_value,

value_set TYPE TABLE OF wdr_context_attr_value.

node_info = wd_context->get_node_info( ).

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

value-value = 'IN'.

value-text = 'India'.

INSERT value INTO TABLE value_set.

value-value = 'US'.

value-text = 'USA'.

INSERT value INTO TABLE value_set.

value-value = 'O'.

value-text = 'Others'.

INSERT value INTO TABLE value_set.

node_info->set_attribute_value_set(

name = `COUNTRY`

value_set = value_set ).

I am requirement here is i want to make India as the default value in the drop down when the page is loaded.

Regards,

Vinod

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

You can directly set the attribute using Code wizard.

Code for your reference :

DATA lo_nd_cn_sflight TYPE REF TO if_wd_context_node.
  DATA lo_el_cn_sflight TYPE REF TO if_wd_context_element.
  DATA ls_cn_sflight TYPE wd_this->element_cn_sflight.
  DATA lv_carrid LIKE ls_cn_sflight-carrid.
* navigate from <CONTEXT> to <CN_SFLIGHT> via lead selection
  lo_nd_cn_sflight = wd_context->get_child_node( name = wd_this->wdctx_cn_sflight ).
* get element via lead selection
  lo_el_cn_sflight = lo_nd_cn_sflight->get_element(  ).
* get single attribute
  lo_el_cn_sflight->set_attribute(
      name =  `ATTribute name.`
      value = 'IN' ).

Set the attribute with the key .

It should work

Former Member
0 Kudos

Hi Saurav,

The issue is solved

Thanks & Regards,

Vinod

Edited by: Vinod_115568 on Nov 26, 2009 6:01 AM

Former Member
0 Kudos

Hi,

I was trying with 'In' instead of 'IN'. i changed to 'IN' and its working now

The issue is solved. Thanks Saurav.

regards,

Vinod

Edited by: Vinod_115568 on Nov 26, 2009 6:01 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

This message was moderated.