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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Alv Tree

0 Kudos

Hi Experts,

Plz let me know how to find out the level count(level number) after expanding the alv tree.

In the UI if i drop down the nodes of a tree till some level, i need to know at what level i am in.

Thanks,

Kumar

1 ACCEPTED SOLUTION

huseyindereli
Active Contributor
0 Kudos

Hi Kumar ,

If you've got the node key of the selected node , than you can easily find the level by the help of GET_PARENT

GET_PATH methods of cl_gui_alv_tree. Otherwise , considering the condition that you can't modify the program it is not possible.

4 REPLIES 4

Former Member
0 Kudos

hi.

This code will help u..

CALL METHOD G_ALV_TREE->ADD_NODE

EXPORTING

I_RELAT_NODE_KEY = P_RELAT_KEY

IS_NODE_LAYOUT = FOLDER

I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD

I_NODE_TEXT = L_NODE_TEXT

IS_OUTTAB_LINE = IT_KUNNR

IMPORTING

E_NEW_NODE_KEY = P_L_DATE_KEY.

in this i_relate_node_key tell the level of selection...

huseyindereli
Active Contributor
0 Kudos

Hi ,

While you're adding nodes to your tree , you can fill an internal table with two fields which has 2 columns ; NODE KEY and LEVEL.

When a node is picked , you can easily get the node key and find the level using the internal table.

OR

you can just write the level inside the structure of the node . You basiclly add a level field and make it invisible.

0 Kudos

Hi,

Thanks for your reply,but here i am not mannully populating the internal table which populates the tree 'or' in other words i cannot do any modifications while tree is gettng populated.

I need to trigger the PAI when i expand the third level of the tree..please let me know how to do this.

Thanks

Kumar

huseyindereli
Active Contributor
0 Kudos

Hi Kumar ,

If you've got the node key of the selected node , than you can easily find the level by the help of GET_PARENT

GET_PATH methods of cl_gui_alv_tree. Otherwise , considering the condition that you can't modify the program it is not possible.