Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

drop down by index

Hi All,

I am trying to put a drop down box to get the PO numbers,

i have created a node 'node1' which has an attribute 'test' of type WDR_CONTEXT_ATTR_VALUE,

then i have an attribute 'po_num' seperately to get the selected value from the drop down box,

now i have the following code in my wddoint method,

data: lr_node type ref to if_wd_context_node,

lr_nodeinfo type ref to if_wd_context_node_info,

lt_valueset type wdr_context_attr_value_list,

ls_valueset type wdr_context_attr_value.

lr_node = wd_context->get_child_node( 'node1' ).

lr_nodeinfo = lr_node->get_node_info( ).

ls_valueset-value = '01'.

ls_valueset-text = '1111'.

append ls_valueset to lt_valueset.

ls_valueset-value = '02'.

ls_valueset-text = '2222'.

append ls_valueset to lt_valueset.

lr_nodeinfo->set_attribute_value_set( name = 'test''

value_set = lt_valueset )

now when i run my application the drop down box doesnot have any values in it,

can anyone help me on this please.

thanks in advance.

Former Member
replied

Hi,

You have defined the attribute type as a structure i.e. WDR_CONTEXT_ATTR_VALUE and trying to set the key value combination to the attribute.

But for DropDown by index UI element we need to create node with cardinality 0..n / 1..n and have the attribute for this node(which are not structure) like WDR_CONTEXT_ATTR_VALUE-VALUE.

And in the WDDOINIT method we can prepare the content and bind it to the node.

For example i have created a node (node1) with cardinality 1..n and created an attribute text (type WDR_CONTEXT_ATTR_VALUE-VALUE). In the view created the dropdownbyindex ui element and associated texts property to the context attribute. In WDDOINIT of the view written the following code.

method WDDOINIT .
  data: lr_node type ref to if_wd_context_node,
        lt_valueset type wd_this->elements_node1,
        ls_valueset type wd_this->element_node1.

lr_node = wd_context->get_child_node( 'NODE1' ).

ls_valueset-test = '01'.
append ls_valueset to lt_valueset.

ls_valueset-test = '02'.
append ls_valueset to lt_valueset.

lr_node->bind_table( lt_valueset ).
endmethod.

For more information regarding Dropdownbyindex and dropdownbykey refer the folloing thread:

how to populate values in dropdownbykey in webdynpro

Best regards,

Suresh

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question