cancel
Showing results for 
Search instead for 
Did you mean: 

Sub node as a subtable

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Archie-Hammer
Explorer
0 Kudos

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

Former Member
0 Kudos

Hi Archie,

Many thanks it is very helpful.

I am now able to fill in my subtable in the context!

Anyway I still have an issue:

All the data are displayed in the first subtable and other subtables are empty:

I think I must change something in the layout regarding the binding?

Any idea?

Judicael

(Dimebag! )

Archie-Hammer
Explorer
0 Kudos

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.

Former Member
0 Kudos

Ok,

I am not too sure what fix this issue (the context was correct anyway) but it now works.

But I have a very last issue: When I scroll in one of the subtable, other subtables in other lines move at the sametime:

Again any idea?

Thanks

Answers (0)