Skip to Content
avatar image
Former Member

How to get data from Recursion Node


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.

Capture.PNG (19.2 kB)
Capture.PNG (12.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    May 26, 2014 at 08:55 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • May 26, 2014 at 10:02 AM

    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


    rec_node.PNG (8.0 kB)
    Add comment
    10|10000 characters needed characters exceeded