Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jun 25, 2009 at 11:21 AM


    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.
         "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.



    Edited by: Raja Sekhar Manne on Jun 25, 2009 1:21 PM

    Add comment
    10|10000 characters needed characters exceeded