Application Development and Automation 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: 
Read only

Issue with alv tree

Former Member
0 Likes
1,371

Hello,

Im using cl_gui_alv_tree_simple to display my internal table in a tree format with the internal table sorted out for three columns. Now when I click on the parent node i shud do an action and when I click at child i need to do a dofferent action. How do i know whether i clicked at the parent node or child node? Is there any event to identify this so that I can go ahead and do my operation for the respective parent and child. Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,275

Hi Vicky,

when you click on any of the node (either parent / child), Method HANDLE_EXPAND_NC will be triggered from the class : CL_GUI_ALV_TREE_SIMPLE.

Important thing is: there will be 4 methods will be called in the method HANDLE_EXPAND_NC.

1) SET_CHILDREN_To_CONTROL

2) ADD_CHILDREN_TO_CONTROL

3) GET_INDEX_FROM_NODE_KEY

4) FRONTEND_UPDATE.

For first 3 of then NODE_KEY will be passed, but when click on the first node (root node) then NODE_KEY will have data as '1', next child node will have as '2' like that. So based on the NODE_KEY value you can find exact node.

Thanks

Satyasuresh Donepudi

Hello,

Im using cl_gui_alv_tree_simple to display my internal table in a tree format with the internal table sorted out for three columns. Now when I click on the parent node i shud do an action and when I click at child i need to do a dofferent action. How do i know whether i clicked at the parent node or child node? Is there any event to identify this so that I can go ahead and do my operation for the respective parent and child. Thanks

10 REPLIES 10
Read only

Former Member
0 Likes
1,275

Does any one have some idea on this? Please reply. Thanks

Read only

0 Likes
1,275

Patience please - the people here have responsibilities outside of the forum.

Rob

Read only

Former Member
0 Likes
1,276

Hi Vicky,

when you click on any of the node (either parent / child), Method HANDLE_EXPAND_NC will be triggered from the class : CL_GUI_ALV_TREE_SIMPLE.

Important thing is: there will be 4 methods will be called in the method HANDLE_EXPAND_NC.

1) SET_CHILDREN_To_CONTROL

2) ADD_CHILDREN_TO_CONTROL

3) GET_INDEX_FROM_NODE_KEY

4) FRONTEND_UPDATE.

For first 3 of then NODE_KEY will be passed, but when click on the first node (root node) then NODE_KEY will have data as '1', next child node will have as '2' like that. So based on the NODE_KEY value you can find exact node.

Thanks

Satyasuresh Donepudi

Read only

Former Member
0 Likes
1,275

Actually I'm using CL_GUI_ALV_TREE and I have like One Main parent Node and three Parent Nodes(3 different fieldnames in a internal table) which can have any number of children. So when I click on parent 1 i shud do some action and when i click on parent 2 i shud do some action. So when i click on some parent how can i find out which parent(fieldname) i clicked on. Please help me out and thanks in advance

Read only

0 Likes
1,275

Hi,

I bet you have created a local class to handle events from CL_GUI_ALV_TREE. Let's say the event is NODE_DOUBLE_CLICK, define your class method in something like this:

handle_node_double_click
        FOR EVENT node_double_click
        OF cl_gui_alv_tree
        IMPORTING node_key,

When you handle this event, you can determine which node was clicked by looking at node_key.

Btw, I have experience in another class (CL_GUI_COLUMN_TREE) but I bet the implementation is similar.

Thanks,

Anfernee

Read only

0 Likes
1,275

Thanks for the Reply, But I Know I can get the Node_key but how can I identify which parent it is based on the node_key. That is my primary question wich is how to find the corresponding parent based on the node_key. I can use ethe method GET_PARENT but it still gives me the node key again where I cnnot identify whether it is what field or what parent it is. Thanks again

Read only

0 Likes
1,275

Use method get_outtab_line

then you get the content of the clicked node

METHOD handle_item_double_click.

PERFORM detail USING node_key.

ENDMETHOD.

FORM detail USING p_node_key.

CALL METHOD tree1->get_outtab_line

EXPORTING

i_node_key = p_node_key

IMPORTING

e_outtab_line = wa_tree.

IF wa_tree-matnr IS INITIAL .

....

ENDIF.

if .

...

endif.

....

best regards

Joerg

Read only

0 Likes
1,275

Hi Can u please tell how you solve this.

With Regards,

Sumodh.P

Read only

Former Member
0 Likes
1,275

Did not get a solution

Read only

Former Member
0 Likes
1,275

T.code : DWDM

in TREE CONTROL u got lot of example