on 02-27-2014 9:24 AM
In our case we need to fetch the values of node, subnode which is in tree structure(Please refer the attachment). Using code wizard we are able to fetch only one record from the table(Parent node value).
In normal table structure, Get_Static_Attribute method will provide all record which is stored in the table. But in this tree table structure we are not sure how to fetch the values of child node.
We can also use Function module to fetch the child node values but the problem here is we want to know the row number a particular child node. For example in the below screen I went to set value for the particular cell(Highlighted), but how can I figure out the row number and set value to the attribute.
Hi,
Try the below code snippet in onSelect event of drop down
DATA lv_index TYPE i.
DATA lr_child TYPE REF TO if_wd_context_node.
DATA lv_ddval TYPE string.
lr_child = context_element->get_child_node( name = 'PARENT.DROP_DOWN' ). " sub node
lv_index = wdevent->get_data ('INDEX' ) " get index of drop down selected value
CALL METHOD lr_child->get_attribute
EXPORTING
index = lv_index
name = 'DDVAL' " Here DDVAL is the attribute of the subnode
IMPORTING
value = lv_ddval.
CALL METHOD context_element->set_attribute
EXPORTING
value = lv_ddval
name = 'PDD'.
*** Here PDD is the name of the Attribute in Parent node to which drop down value is set.
Also check this document for reference;
Hope this helps u,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the example, drop down indicates child node.
Or try the below code to set value to child node in general case.
lo_el_parent = lo_nd_parent->bind_structure( new_item = ls_parent set_initial_elements = abap_false ).
lo_nd_child= lo_el_parent->get_child_node( 'CHILD_NODE' ).
lo_nd_child->bind_structure( new_item = ls_child
set_initial_elements = abap_false ).
Or you can access the child node using
lo_nd_nodeb = wd_context->path_get_node( path = `NODEA.NODEB` ).
Hope this helps u,
Regards,
Kiran
Hi Rahul,
You can get the child node data as below
- Let us say we have parent node "TASK_HEAD"
- We have a child node 'TASK_DETAIL" inside the node "TASK_HEAD"
- Get the child node reference at specified index as below
- Find out the index of the entry DEVELOPMENT into lv_index
lo_child_node =
lo_nd_radio->path_get_node(
path = 'TASK_HEAD.TASK_DETAILS'
start_index_for_element_index = lv_index " index of the
).
- using lo_child_node->get_static_attributes_table( ), you can get the data of the child node
- Loop over entries and set the values as required
Note: There will be keys associated to the entries of tree, get the index of row by reading data based on these keys
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.