Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

How to read or get subnode as table operation

Former Member
0 Kudos

Hi experts!

I have a question ...

I have a parent node and want to get the values ​​of the child node. This child node has cardinality 0..n. Wanted to know a way to get the value of it for each record in the parent node.

The child node like it to be sort an internal table.

I tried to do so, but the child node is empty ... Since there are records for it ...


DATA lt_node_export_pdf         TYPE ypcadt_risk_control_pdf.

   DATA ls_node_export_pdf         TYPE ypcads_risk_control_pdf.

   DATA lt_risk_history            TYPE ypcadt_risk_status_history_exp.

   DATA ls_risk_status_history_exp TYPE ypcads_risk_status_history_exp.

   DATA lo_nd_node_export_pdf      TYPE REF TO if_wd_context_node.

   DATA lo_el_node_export_pdf      TYPE REF TO if_wd_context_element.

   DATA lt_collection              TYPE wdr_context_element_set.

   DATA lo_nd_risk_status_exp      TYPE REF TO if_wd_context_node.

   DATA lt_risk_status_exp         TYPE ypcadt_risk_status_history_exp.

   DATA ls_risk_status_exp         TYPE wd_this->element_risk_status_exp.

* navigate from <CONTEXT> to <NODE_EXPORT_PDF> via lead selection

   lo_nd_node_export_pdf = wd_context->get_child_node( name = wd_this->wdctx_node_export_pdf ).

   lt_collection = lo_nd_node_export_pdf->get_elements( ).

   LOOP AT lt_collection INTO lo_el_node_export_pdf.

     lo_el_node_export_pdf->get_static_attributes( IMPORTING static_attributes = ls_node_export_pdf ).

*   navigate from <CONTEXT> to <RISK_STATUS_EXP> via lead selection

     lo_nd_risk_status_exp = wd_context->path_get_node( path = `NODE_EXPORT_PDF.RISK_STATUS_EXP` ).

     lo_nd_risk_status_exp = lo_el_node_export_pdf->get_child_node( 'RISK_STATUS_EXP' ).

     lo_nd_risk_status_exp->get_static_attributes_table( IMPORTING table = lt_risk_status_exp ).

     ls_node_export_pdf-t_risk_history = lt_risk_status_exp.

     APPEND ls_node_export_pdf TO lt_node_export_pdf.



In case I want to populate a field of the internal table with the values ​​found in the child node. This field is a subtable.

Thanks for your attention people!


Former Member
0 Kudos

Hi Fabiana,

Try this way:

lo_nd_risk_status_exp = wd_context->path_get_node( path =`NODE_EXPORT_PDF.RISK_STATUS_EXP` ).

*---the line below is New

lo_el_node_export_pdf = lo_el_node_export_pdf->get_element( sy-tabix ). "Use a variable for Loop sy-tabix

lo_nd_risk_status_exp = lo_el_node_export_pdf->get_child_node( 'RISK_STATUS_EXP' ).