on 04-03-2012 8:43 AM
Hi all,
I need your help on designing context nodes.
What I need is
NodeA(o..n)
--------child1(0...n)
--------child2(1..1)
-----childattribute (String)
Iam unable to figure out how to fill values and access the child nodes (child 1 and child 2).
Any code snippets would be helpfull.
I tried retrieving the child1 using get_child_node of nodeA reference but it is not working when nodeA is 0..n (It works when nodeA is 1..1).
Thanks and regards
M Karthiheyan
Hi all,
Thanks for your answers ..
I have solved the problem.
Initially the entire node was empty.
So to bind values to subnode I need reference of the element referring to the current instance.
When I bind a structure to the parent node , it returns me the reference as element for that instance with which I can get the child nodes and bind table values .
Code Snippet
le_parent = ln_parent->bind_structure( new_item = ls_parent set_initial_elements = abap_false ).
ln_child= le_parent->get_child_node( 'child' ).
ln_child->bind_structure( new_item = ls_child
set_initial_elements = abap_false ).
Thanks and regards,
Karthiheyan M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this thread.
http://scn.sap.com/thread/3156362
Key is to understand "A Child node exists on a Parent Element"
Regards,
Ashish Shah
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Karthikeyan ,
DATA : LT_Contextnode_elements(0..N) TYPE wdr_context_element_set,
LT_Contextnode_elements TYPE REF TO if_wd_context_element,
lt_child_node_table type table of wd_this->elements_child_table ,
Lo_Child_node TYPE REF TO if_wd_context_node.
* Get the refence of all the parentnode elements
LT_Contextnode_elements = lo_node->get_elements( ).
* Loop at the elements for indiviual refence and set the subnode of *0..n * Cardinality
LOOP AT LT_Contextnode_elements INTO LS_Contextnode_elements.
*Get Refence of child node
Lo_Child_node =LS_Contextnode_elements->get_child_node( name = ‘CHILD_NODE’ ).
Lo_Child_node->bind_table( new_items = lt_child_node_table set_initial_elements = abap_true ).
ENDLOOP .
Thanks ,
Venkat ratnam naidu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Karthikeyan,
Here is the algorithm to fill the context nodes in WD ABAP:
1. Declare variable referring to the context node:
MY_NODE type ref to IF_WD_CONTEXT_NODE.
2. Obtain the reference to the actual context node:
MY_NODE = WD_CONTEXT->GET_CHILD_NODE( ' <Name of the node> ' ).
3. Obtain the values in an internal table which is related to the type of the node
4. Bind the values to the node
MY_NODE->BIND_ELEMENTS ( <Value table> ).
Use the code wizard initally for understanding.
Regards,
Sharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use Web Dynpro Code wizard ( magic stick button, beside pattern button in the toolbar ) and select the node and use read or set. It will automatically generate the code.
Else if you want to access attributes inside child node, write like this,
lo_nd_nodeb = wd_context->path_get_node( path = `NODEA.NODEB` ).
where nodeb is child of nodea.
Use code wizard, which generates the required code automatically.
Hope this helps u,
Thanks & Regards,
Kiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.