Skip to Content
avatar image
Former Member

value table in drop down

Hi

I have a value table and i have to show its values in a front end in a drop down element.

Please suggest the steps.

Thanks

Preeti Khurana

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 23, 2010 at 05:34 AM

    Hi

    I think, one of the ways is to use Drop Down by Key UI Element. Following are the steps for the same:

    1) Place the DropDownByKey UI element on the view

    2) Bind it with the context attribute

    3) Write following code in the WDDOINIT method, if you want to display drop down list from initial

    
    "  Get info of node which contains attribute
      DATA node_info TYPE REF TO if_wd_context_node_info.
    
      node_info = wd_context->get_node_info( ).
      node_info = node_info->get_child_node( name = `CN_DATA` ). 
    
    "  Move the values that you want to display to the internal table of type  WDR_CONTEXT_ATTR_VALUE_LIST
      DATA: t_valueset TYPE wdr_context_attr_value_list,
                 z_value     TYPE wdr_context_attr_value.
    
    " Internal table 't_week' will be a table which will have records that you want to display in drop down
      LOOP AT t_week INTO z_week.
    " Internal value to be used for text in dropdown
        z_value-value = z_week-day.           
    " Text to be displayed in dropdown
        z_value-text = z_week-day.             
        INSERT z_value INTO TABLE t_valueset.
        CLEAR: z_value, z_week.
      ENDLOOP.
    
    " Set the values to the context attribute
      node_info->set_attribute_value_set(
      name = `CA_DAY`         " Attribute to which dropdown values are to be attached
      value_set = t_valueset ).
    
    

    Refer [Link|http://help.sap.com/erp2005_ehp_04/helpdata/EN/c5/e4884180951809e10000000a155106/frameset.htm] for more help

    Regards,

    Saket.

    Add comment
    10|10000 characters needed characters exceeded