2010 Feb 03 7:21 PM
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
2010 Feb 03 10:03 PM
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
2010 Feb 03 7:46 PM
2010 Feb 03 7:51 PM
Patience please - the people here have responsibilities outside of the forum.
Rob
2010 Feb 03 10:03 PM
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
2010 Feb 10 2:41 AM
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
2010 Feb 10 7:28 AM
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
2010 Feb 10 1:51 PM
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
2010 Feb 10 2:17 PM
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
2010 Aug 24 10:39 AM
Hi Can u please tell how you solve this.
With Regards,
Sumodh.P
2010 Feb 10 3:14 AM
2010 Feb 10 7:00 AM