cancel
Showing results for 
Search instead for 
Did you mean: 

How to get data from Recursion Node

Former Member
0 Kudos


Hi,

I've done one hierarchy table. i'll expand the data and will check values under hierarchy. i've used for this hierarchy Recursion node.

Now i want to download this data into excel. Expanded data is not coming only main node data coming. At time of expanding im binding data to recursion node. Now how to get data from recursion node.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Please see this example DEMO_TABLE_WITH_TREE .On the click of parent node,you will get all the child node(where based on condition, you will bind the child nodes). Move that child nodes data into global internal table and use that itab for your data manipulation.

Hope this helps you.

Thanks

KH

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Jack,

You can achieve your requirement as below

  • Get the data of parent node into an internal table lt_parent_data
  • loop over lt_parent table
    • get the current element based on the index
    • get the child node of that element based on RECURSIVE node name into lo_nd_rec
    • get the data of recursive node from lo_nd_rec

Example:

I have the context node as below

To read the data of recursive node REC_ORG_UNIT, check the below code


method ONACTIONGET_DATA .

  DATA lo_nd_org_unit TYPE REF TO if_wd_context_node.

  DATA lt_org_unit TYPE wd_this->Elements_org_unit.

  data ls_org_unit LIKE LINE OF lt_org_unit.

  data lo_element  TYPE REF TO if_wd_context_element.

  data lo_nd_rec  type REF TO if_wd_context_node.

  data lt_recursive_data like  lt_org_unit.

  DATA LT_TEMP LIKE lt_recursive_data.

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

  lo_nd_org_unit = wd_context->get_child_node( name = wd_this->wdctx_org_unit ).

  lo_nd_org_unit->get_static_attributes_table( importing table = lt_org_unit ).

  refresh lt_recursive_data.

  LOOP AT lt_org_unit INTO ls_org_unit.

    lo_element = lo_nd_org_unit->get_element( index = sy-tabix ).

    IF lo_element is BOUND.

      lo_nd_rec = lo_element->GET_CHILD_NODE( name = 'REC_ORG_UNIT' ).

    ENDIF.

    IF lo_nd_rec  IS BOUND.

      lo_nd_rec->get_static_attributes_table( importing table = lt_TEMP ).

      free lo_nd_rec.

    ENDIF.

    APPEND LINES OF LT_TEMP TO lt_recursive_data.

  ENDLOOP.

endmethod.

Hope this helps you.

Regards,

Rama