cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown_by_key within table not populating

Former Member
0 Kudos

I hate to do this, but I am having trouble with a dropdown_by_key within a table. I have scoured SDN and found multiple articles, but nothing that addresses my problem. I found multiple posts say that when you create a context that is typed to a domain with a value range and then bind that context to a dropdown_by_key that the values within the value range will automatically be populated within the drop down. Well that is not the case for me. When I run my WD application the drop down is blank. Any one know why?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

The reason might be the attribute is not bound to a domain in the DDIC. Check this out and see if it helps when you have a data element from domain.

Former Member
0 Kudos

Hi,

DDK gets populated automatically when the domain has fixed values in Value Range. If it has a value table in Value range it does not get populated automatically.

In the case of Value Table you need to code to fill the drop down by key in WDDOINIT or supply function. Plus the node to which it is bound should have a cardinality 1:n.

Say you want ddk for LIFNR of table LFA1.

DATA:

it_tab TYPE wd_this->elements_node_name,

ls_tab TYPE wd_this->element_node_name.

DATA:

it_valueset TYPE wdr_context_attr_value_list,

ls_valueset TYPE wdr_context_attr_value.

SELECT lifnr FROM lfa1 INTO it_tab.

LOOP AT it_tab INTO ls_tab.

ls_valueset-value = ls_tab-lifnr.

ls_valueset-text = ls_tab-lifnr.

APPEND ls_valueset TO it_valueset.

ENDLOOP.

DATA:

lo_node TYPE REF TO if_wd_context_node,

lo_info TYPE REF TO if_wd_context_node_info.

lo_node= wd_context->get_child_node( 'NODE_NAME' ).

lo_info = lo_node->get_node_info( ).

lo_info->set_attribute_value_set( name = 'LIFNR' value_set = it_valueset ).

This will fill the drop down key.

Former Member
0 Kudos

Hello,

Try these steps..

  • First create a node range and create an attribute assign the data element which u have to refer to for fetching values...

Make sure the cardinality for the field is 0...n... Also mention the Supply function as FILL_LIST..

  • Click on the method FILL_LIST under the component controller ...Select the values of the ranges..

  • Get number ranges defined

* data declaration
  DATA lt_node_range TYPE wd_this->Elements_node_range.
  DATA ls_node_range LIKE LINE OF lt_node_range.
SELECT ddtext FROM dd07v INTO TABLE lt_node_range
                   WHERE domname = 'ZTEXT'
                    AND  DDLANGUAGE = sy-langu.
* bind all the elements
  node->bind_table(
    new_items            =  lt_node_range
    set_initial_elements = abap_true )

  • Now *assign the node range *to the drop down field in the view...

Execute and see your drop down should hold the required values...

Hope this helps, let me know if you have further clarifications.

Regards,

Judith.