cancel
Showing results for 
Search instead for 
Did you mean: 

How to get values or data into drop down by key with help of codings?

Former Member
0 Kudos

Hi SAP Experts,

I am new to webdynpro.......................plz help me how to get values or data into drop down by key with help of coding............

Thanks a lot in advance...................................

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

you need to create one UI element dropdownby key and bind its seledted key property to one attribute inside the node.

then you need to fill the valueset for the attribute in the wddoinit.


 DATA lo_nd_dealer TYPE REF TO if_wd_context_node.
lo_nd_dealer = wd_context->get_child_node( name = wd_this->wdctx_dealer ).
  Data : lt_valueset type table of wdr_context_attr_value,
         ls_valueset type wdr_context_attr_value,
         lr_node_info type ref to if_wd_context_node_info,
         wa_dealr type zdealer.

 lr_node_info = lo_nd_dealer->get_node_info( ).

 Do 5 times.
   ls_valueset-value = sy-index.
   ls_valueset-text = sy-index.
   append ls_valueset to lt_valueset.
   enddo.

   lr_node_info->set_attribute_value_set(
   name = 'NAME'
   value_set = lt_valueset ).  

this will fill the value set of the attribute with number 1 to 5.

you can fill acording to the requirement like reading it from internal table and tehn fiiling it etc.

let me know if you need more help.

Thanks

Sarbjeet

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Context

|_Book(1..1)

|__bookname

Insert a dropdownbykey UI element in view and bind the selected key

property to bookname attribute.

In WDDoInit method write the below code to populate the dropdown

Data: lo_nd_book type ref to if_wd_context_node,
      lr_node_info type ref to if_wd_context_node_info,
      ls_valueset type wdr_context_attr_value,
      lt_valueset type table of wdr_context_attr_value.

lo_nd_book = wd_context->get_child_node( name = 'BOOK' ).
lr_node_info = lo_nd_book->get_node_info( ).

ls_valueset-value = 'WDABAP'.	
ls_valueset-text  = 'Net310'.
append ls_valueset into lt_valueset.

call method lr_node_info->set_attribute_value_set
Exporting
  Name = 'BOOKNAME'
  value_set = lt_valueset.

Regards,

Bala Baskaran.S

Edited by: Bala Baskaran on Jan 4, 2011 12:18 PM

sahai
Contributor
0 Kudos

hi,

go through this link.if the problem pertains still tell me

thanks and regards,

sahai.s

Former Member
0 Kudos

Hi alagappan,

Please have look on the below link:-

[ Drop down|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c03227f9-e48f-2c10-4bad-8ebdec704f3d?quicklink=index&overridelayout=true]

Thanks & Regards,

Monishankar Chatterjee

Former Member
0 Kudos

just search SDN or google

Thanks

Bala Duvvuri