Skip to Content
author's profile photo Former Member
Former Member

Fromating Hierarchical ALV using cl_gui_alv_tree ->Add_node (For Dynamic Internal Table)

Hello ABAP Guru's,

I am having Internal table <fl_final> dynamic .

(We can't hard code any fields while building logic like Node1 = Node 2 because it is dynamic )

Node1 Node2 Node3 Node4 Account Number Asserts A-Current A-Current1 A-Current1.1 00002569 Asserts A-Current A-Current1 A-Current1.1 00002570 Asserts A-Current A-Current1 A-Current1.2 00002571 Asserts A-Current A-Current1 A-Current1.2 00002572 Asserts A-Current A-Current2 A-Current2.1 00002573 Asserts A-Current A-Current2 A-Current2.2 00002574 Asserts A-Current A-Current2 A-Current2.2 00002575 Asserts A-Noncurrent A-NonCurrent1 A-NonCurrent1.1 00002576 Asserts A-Noncurrent A-NonCurrent1 A-NonCurrent1.1 00002577 Asserts A-Noncurrent A-NonCurrent1 A-NonCurrent1.2 00002578 Asserts A-Noncurrent A-NonCurrent1 A-NonCurrent1.2 00002579

Now I want to display this as Hierarchical node format

Hierarchy looks like below (For first 7 records )

1. Asserts

2. A-Current




3 A-Current 1.2






3 A-Current 2.2



I hope you understand rest of records how it has to come.

Kindly give valuable logic to achieve this.

Note : I am using class cl_gui_alv_tree

Thanks in Advance,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2015 at 05:59 AM

    Any way to achieve the above format????

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 14, 2015 at 06:20 AM


    Usually tables that hold hierarchical data looks like this .

    From Hierarchical database model - Wikipedia, the free encyclopedia

    If your data is stored like this you can use recursion and build a tree using cl_gui_alv_tree .

    See program BCALV_TREE_01 .


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.