Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Filling nested nodes (tables)

Hello experts

I'm working with nodes with have nested nodes because i have a header-detail tables.

When I try to fill the father table node with the internal table wich has the subtable, it fills the node but does not fills the nested node:

lo_nd_header->bind_table( lt_header )  " Does not fill the nested table nodes

So i need to fill the header node and then make a cycle to fill the subnode for each header record, something like this:

lo_nd_header->bind_table( lt_header )

LOOP AT lt_header INTO ls_header

      lo_nd_detail = lo_nd_header->get_child_node( name = 'DETAIL'    index = sy-tabix )   

      lo_nd_detail->bind_table( ls_header-detail )   "  ls_header-detail  is a table

ENDLOOP

My doubt is if there is a way to fill a node including its nested table nodes in one step without need to make a cycle.

I guess is not possible because how can we get the child node if there is not created yet the corresponding header node record; but i'm trying to check it because if we have a 3 levels nested tables i think then we need to have nested LOOPs , something like this:

lo_nd_header->bind_table( lt_header )

LOOP AT lt_header INTO ls_header

     lo_nd_detail = lo_nd_header->get_child_node( name = 'DETAIL'     index = sy-tabix )

     lo_nd_detail->bind_table( ls_header-detail )

     LOOP AT ls_header-detail INTO ls_detail

           lo_nd_subdetail = lo_nd_detail->get_child_node( name = 'SUBDETAIL'  index = sy-tabix )

           lo_nd_subdetail->bind_table( ls_detail-subdetail )

     ENDLOOP

ENDLOOP

Regards

Frank

Tags:
Not what you were looking for? View more on this topic or Ask a question