on 01-08-2013 5:43 PM
Hello world,
I'm trying to create a context for a table containing another table.
So I created a context as follow:
Node (Cardinality 0 .. n)
- Subnode (Cardinality 0 .. n)
Is it correct? Will I have a table subnode for every row of node?
My issue is that in the code I can't access to the subnode from the node.
I do something like this (here I want to fill nodes to then bind it to the context) :
DATA:
nodes TYPE wd_this->elements_node,
node LIKE LINE OF nodes.
node-subnode = ...
And here I get the error : The data object "node" does not have a component called "subnode".
How can I fix this?
Thank you all.
Judicael
Hello Judicael,
you are getting the error because you are trying to access the child node from the wrong level. Get the instance of an element of the parent before trying to get the child node. The code below should allow you to loop through all the child nodes.
data: lo_nd_parent type ref to if_wd_context_node,
lo_nd_child type ref to if_wd_context_node.
data: lo_el_parent type ref to if_wd_context_element.
data: it_parent_els type wdr_context_element_set.
lo_nd_parent = wd_cotnext->get_child_node( name = wd_this->wdctx_parent ).
it_parent_els = lo_nd_parent->get_elements.
loop at it_parent_els into lo_el_parent.
lo_nd_child = lo_el_parent->get_child_node( name = wd_this->wdctx_child ).
endloop.
hope this helps.
Archie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would double check the context at run-time and make sure the data is in the "correct" place. The screen shot looks like the sub-node of the first element was filled with all the sub-node information. If you see that the context looks good at run-time then the binding is next place to look.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
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.