cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down by Key

Former Member
0 Kudos

Hi,

I am having a drop down by key UI element and this is bind to a custom data element zcust. data type for this is zdata.

In the data type value range value table is specified.

This table contains the value but these are not visible in drop down, please suggest how can i proceed so that these value come in drop down by key by default. And also how can i wil get the key for entries.

Regards,

Pankaj Aggarwal

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

value table is showin as F4 if it is Input field, if you make it dropdown you have to fill the attribute value set as Misbah suggested.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

If you are using drop down by key, please used a data element whose domain contains fixed values. Value table content dont apprear with DDK uIElement.

Other way is to fill your drop down at run time. It is there in one of the answers or use drop down my index and bind it with a context node which contains the data as it in in your value table.

Regards

Vishal Kapoor

Former Member
0 Kudos

Hello Pankaj,

Here is the sample example in which i was using the drop down by key Ui element which has a context selection data and attribute as "YEAR' . My requirement was to fill the years into this dropdown. Before proceeding to the further steps let e tell you that when we are using the Drop down by Key UI element we need not require any special node nor cardinality needs to be as 0:n as we do it for drop by Index.

Below is the sample code:

  
  DATA  lo_nd_selection_data  TYPE REF TO if_wd_context_node.
  DATA  lt_value_set          TYPE wdr_context_attr_value_list.
  DATA  ls_value              TYPE wdr_context_attr_value.
  DATA  lo_node_info          TYPE REF TO if_wd_context_node_info.
  DATA  lv_year_n             TYPE apyear.

  lv_year_n = 2006.

  DO 10 TIMES.

    ls_value-value  = lv_year_n.
    ls_value-text   = lv_year_n.
    INSERT ls_value INTO TABLE lt_value_set.

    lv_year_n = lv_year_n + 1.
  ENDDO.

  lo_nd_selection_data = wd_context->get_child_node( name = wd_this->wdctx_selection_data ).
  lo_node_info = lo_nd_selection_data->get_node_info( ).

  lo_node_info->set_attribute_value_set(
    EXPORTING
      name      =     'YEAR'   " Web Dynpro: Name of Context Element
      value_set =     lt_value_set  " All Fixed Values of an Attribute with Texts
  ).
     

Note : we need to take care that key value is not repeated if it is repeated then it will lead to dump.

Good Day ..

Regards.

Sana.......