cancel
Showing results for 
Search instead for 
Did you mean: 

TreeByKeyTableColumn:

former_member187651
Active Participant
0 Kudos

Dear Experts,

I have implemented 'Tree by key table column' in my webdybnpro application.Its working great.

Now I got an requirement to get the hierarchy sequence of this table in my internal table and display Report accordingly.

For example: My table tree contains the nodes like (WHEN EXPANDED).

A

--A1

   --A11

--A2

      --A21

            ---A211

            ---A212

This comes with parent - child relationship.

Now my requirement is to get the value in my itab as: (as shown in the expanded structure)

A

A1

A11

A2

A21

A211

A212

Please give some logic to fill my itab accordingly.

Waiting for reply...

Regards,

Chandan.

Accepted Solutions (0)

Answers (2)

Answers (2)

harsha_jalakam
Active Contributor
0 Kudos

Hi Chandan,

     Its better to use ALV than Normal table UI, because in normal table UI, its difficult to use Sorting and and Filtering, with the requirement you have specified.

     But if you go for ALV, its easy to implement and gives all inbuilt features like filtering and sorting, without any extra implementation.

     Please find the link for reference both in ALV and Normal Table UI.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5c...

Regards,

Harsha

former_member187651
Active Participant
0 Kudos

Hello Harsha,

Thanks for your reply. but can not use ALV in this case as table structure to display hierarchy of

Parent - child relationship do not allow me to use this. ALV uses different type to relation table to display the tree. Also there are some more functional objects which can not be implement with ALV tree.

I need to make the solution with Table tree UI element.

Please suggest.

Former Member
0 Kudos

I Chandan,

The solution comes from the relation you mentionned : you have to follow the child relation of each element. It's a recursive code.

For exemple this algorithm could work :

global_itab

get_element_recursive( exporting tree_first_element )

method get_elements_recursive( importing current_element )

     append current_element to global_itab

     if current_element->has_child.

          loop at current_element->childs into child.

               get_elements_recursive( exporting child ).

          endloop.

     endif.

endmethod.

This will fetch all your elements following the parent -> child relation in order.

former_member187651
Active Participant
0 Kudos

Please give some logic or relevant answer to get the desired result....

Any doubt, please let me know....

its urgent to me....

Regards,

Chandan