Skip to Content
avatar image
Former Member

Filling nodes

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Oct 09, 2009 at 11:06 AM

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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.