cancel
Showing results for 
Search instead for 
Did you mean: 

drop down by index

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

S-H
Active Participant
0 Kudos

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:

Best regards,

Suresh

Former Member
0 Kudos

Hi Suresh,

Thanks a lot it solved my problem.

Now i want to read the values from drop down box, how do i do that,

and as of now the drop down box have value, i want to have null value in it and if i click the drop down then i want to see the values,

now the first value in lt_valueset gets displayed in dropdown box.

Help me on this.

Thanks in advance.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi ,

I have used drop down by key :

data: lr_node type ref to if_wd_context_node,
lr_nodeinfo type ref to if_wd_context_node_info,

lr_node = wd_context->get_child_node(  ).


  data :     lr_nodeinfo         type ref to if_wd_context_node_info,
lt_valueset  type wdy_key_value_table,
         ls_valueset      type wdy_key_value,

 ls_valueset -key    = '01'.
  ls_valueset -value  = '01'.
  insert ls_valueset  into table lt_valueset.
 ls_valueset -key    = '02'.
  ls_valueset -value  = '02'.
  insert ls_valueset  into table lt_valueset.
  
lr_nodeinfo = lr_node->get_node_info( ).
  lr_nodeinfoset_attribute_value_set( name = 'TEST' value_set = lt_valueset ).

This is should work or pls change the test in capital letter and check it again.

Regards

Sathish

Former Member
0 Kudos

Hi Satish,

Thanks for your reply,

even after changing it to 'TEST' it does not work for me.