How to add database values to dropdownkey values
Hi all,
I have one dropdownkey UI Element in the view.
I want to add the database table field values to the dropdown key ..
how to get this
Former Member replied
Hi,
Below are the steps to create dropdownbykey.
1. Create a UI element type dropdownbykey in layout
2. create a context NODE1 and add attribute ATTR1 type DATS(what ever can be the type) under it
3. Bind this context attribute ATTR1 to ui element
4. Write below code to WDINIT() method of view or component controller to set possible values for dropdown
data: value type WDR_CONTEXT_ATTR_VALUE, value_set type WDR_CONTEXT_ATTR_VALUE_LIST. data node_info type ref to if_wd_context_node_info. node_info = wd_context->get_node_info( ). "here replace node1 with your node node_info = node_info->get_child_node( wd_this->wdctx_node1 ). * Get the values from DB here select * from SPFLI into lt_tab. loop at lt_tab into wa_tab. value-value = wa_tab-conn_id "what ever the field value-text = 'text'. "text to appear in UI insert value into table value_set. endloop. "this method set the value set to dropdown node_info->set_attribute_value_set( name = 'ATTR1' value_set = value_set ).
Note: just to show example i have written a DB query here, but you should use API for that.
Regards,
Manne
Edited by: Raja Sekhar Manne on Jun 25, 2009 1:21 PM