on 09-07-2011 3:06 PM
Hi all,
I have been working for the last several days on this and can not figure it out. Here is what I am trying to accomplish. I have copied the context from the component controller to the context of the view. In the view I have created 2 nodes that are identical, one is mapped to the component controller context and the other is not, but bound to elements of the view. I want to be able to take the data from the mapped context filter the data and then pass what I want into the unmapped context. The problem I am running into is that I am having trouble accessing my subnode. I can get a reference to the node: context->node1 using both get_child_node and path_get_node, but when I try to create a reference to the subnode: context-node1-node2, which has the data I want displayed on the view, the reference is always returned null. The component I am working on was already in place, so I don't want to change the order of the nodes. Does anyone know why when I try to get a reference to the subnode I always get a null reference value? I tried creating a test web dynpro component and created a node with a subnode with data in it and had the same problem. Thank you for your time and help.
Michael
Hello,
just wanted to confirm about how you are getting the reference for the node2... are you retrieving the reference of node2 in the same way like the one mentioned below
data lo_nd_node1 type ref to if_wd_context_node
data lo_nd_node2 type ref to if_wd_context_node
data lo_el_node1 type ref to if_wd_context_element
lo_nd_node1 = wd_context->get_child_node( 'NODE1' ).
lo_el_node1 = lo_nd_node1->get_element( ).
lo_nd_node2 = lo_el_node1->get_child_node( 'NODE2' ).
BR, Saravanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is what the context looks like:
Context
___I
___I--->NODE1
_________I
_________I--->SUBNODE
(Sorry I tried using spaces, but it kept realigning my text to the left, just ignore the underscores)
No, this is what I've been doing.
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
* navigate from <CONTEXT> to <CAUTH_COMV_V> via lead selection
lo_nd_node = wd_context->path_get_node( path = `NODE.SUBNODE` ).
* I have also tried this
lo_nd_node = wd_context->get_child_node( name = `NODE1` ).
lo_nd_node = lo_nd_node->get_child_node( name = `SUBNODE` ).
* get element via lead selection
lo_el_ = lo_nd_->get_element( ).
Edited by: champion661 on Sep 7, 2011 5:07 PM
If i am not wrong you would have declared element reference to your subnode as
DATA lo_el_ TYPE REF TO if_wd_context_element.
Else Please declare it as above if you dint declare it , and change the statement below in your code:
lo_el_ = lo_nd_->get_element( ).
as
lo_el_ = lo_nd_node->get_element( ).
It will work now.Even if it is not getting path correctly in your code : code it normally as follows:-
DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
DATA lo_nd_node2 TYPE REF TO if_wd_context_node.
DATA lo_el_node2 TYPE REF TO if_wd_context_element.
DATA ls_node2 TYPE wd_this->element_node2.
lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
lo_nd_node2 = lo_nd_node1->get_child_node( name = wd_this->wdctx_node2 ).
lo_el_node2 = lo_nd_node2->get_element( ).
lo_el_node2->get_static_attributes( IMPORTING static_attributes = ls_node2 ).
In the above code, node 1 is main node and node 2 is subnode to node1 as in regard with your scenario.
Let me know if there are still any issues.
Regards,
Praveen kambala.
Sorry that was a typo, ok I'll try that out thanks.
I tried it and it didn't work. I set the subnode to have 1..n cardinality. Here is the code.
The node= CAUTH_DATA
The subnode= CAUTH_COMV
DATA lo_nd_cauth TYPE REF TO if_wd_context_node.
DATA lo_nd_cauth2 TYPE REF TO if_wd_context_node.
DATA lo_el_cauth TYPE REF TO if_wd_context_element.
DATA ls_cauth_comv_v TYPE wd_this->element_cauth_comv_v.
* navigate from <CONTEXT> to <CAUTH_COMV_V> via lead selection
lo_nd_cauth = wd_context->path_get_node( path = `CAUTH_DATA_V` ).
lo_nd_cauth2 = lo_nd_cauth->path_get_node( path = `CAUTH_COMV_V` ).""""""""
lo_nd_cauth2 = lo_nd_cauth->get_child_node( name = wd_this->wdctx_cauth_comv_v ).""""""""
* lo_nd_cauth2 = lo_nd_cauth->path_get_node( path = `CAUTH_COMV_V` ).
lo_el_cauth = lo_nd_cauth2->get_element( ).
I was trying different ways to get a reference the two lines with the ' """"""" ' at the end both returned a null reference and so on the last line it dumps here.
Hi micheal,
create an internal table and append all the values from the node(which is mapped) after that attach the internal table to the other node,you can also try,read the values of the node for example:ls_material here material is the node which is mapped,after that send the values to the other node.Try once,hope it helps.Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.