cancel
Showing results for 
Search instead for 
Did you mean: 

Filling nodes

Former Member
0 Kudos

Hi,

I have a question to all experts.

My situation is the following:

I have a node NODEMAIN. This node has 3 attributes and a sub node SUBNODE, which has another 3 attributes.

I know have a function, which is returning one table with the 3 attributes for the NODEMAIN and a nested table with the

information for SUBNODE.

How can I know fill my node and subnode with this information in the easiest way? Do I have to fill at first the NODEMAIN and

loop that node to fill the SUBNODE?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What is the cardinality that you have set for both the nodes

Former Member
0 Kudos

1..n and 1..n. So both are basically tables. One node from NODEMAIN can have several SUBNODES.

Former Member
thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Supply function will load on demand, which can be really good if you have a lot of records in the parent table and will rarely access all the children.

On the other hand you can preload all the children by looping through an element list of the parent node. Here is an example:

****Loop Through all the Items
  data element_set type wdr_context_element_set.
  field-symbols <wa_set> like line of element_set.
  field-symbols <wa_item> type sdemo_so_item_all.
  data l_tabix type sytabix.
  element_set = lo_nd_sales_items->get_elements( ).
  loop at element_set assigning <wa_set>.
    l_tabix = sy-tabix.
    read table <wa_so>-t_item assigning <wa_item> index l_tabix.

*****Load WDCTX_SCHEDULE_LINES
    data lo_nd_schedule_lines type ref to if_wd_context_node.
    data lt_schedule_lines type wd_this->elements_schedule_lines.
    lo_nd_schedule_lines = <wa_set>->get_child_node( name = if_componentcontroller=>wdctx_schedule_lines ).
    lt_schedule_lines = <wa_item>-t_sl.
    lo_nd_schedule_lines->bind_table( new_items = lt_schedule_lines set_initial_elements = abap_true ).

endloop.

Answers (0)