on 03-12-2015 6:35 PM
Hi,
I have a requirement wherein I want to initialize the element of subnode in the context? I know how initialize a element of a normal node.
Please help fast.
Thanks
Hi Ajinkya,
To get the element of subnode, you should know the element index of parent node and use the method PATH_GET_NODE of interface IF_WD_CONTEXT_NODE.
Please refer below links:
Reference Path to Deeper Context Nodes - Web Dynpro for ABAP - SAP Library
Other way, get child node
data lo_parent_node type ref to if_wd_context_node.
data lo_child_node type ref to if_wd_context_node.
data lo_element type ref to if_wd_context_element.
lo_parent_node = wd_context->get_child_node( name = 'MY_PARENT_NODE' ).
" get the index of node which you are willing
lo_element = lo_parent_node->get_element( 2 ). " sub node of second line
lo_child_node = lo_element->get_child_node( name = 'MY_CHILD_NODE' ).
LO_CHILD_NODE->INVALIDATE( ).
Also, you can use supply function to set the value/initialize subnode based on parent node's element .
Please refer the below link
Supply function with singleton concept | Team ABAP
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.
Thanks,
But by this I'm able to initialize only 1st sub node i.e lo_element = lo_parent_node->get_element( 1 ).
If I give lo_element = lo_parent_node->get_element( 2 ) I'm getting error "Null Object Reference not possible".
I want to initialize first four sub nodes of the parent node.
Please help.
Hi Ajinkya,
Supply functions can be used in this case for initializing the sub-node elements, to the corresponding parent element. Since at runtime we can not decide how many elements does exists in the parent node, it is better not to initialize the elements through sa-tabix values. Or if the number of elements in both parent and the child node are fixed then , manual initialization could be followed.
Regards,
Harsha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
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.