‎2007 Jan 25 12:59 PM
Hello Friends,
We are working on ALV Trees.
this is the sample code:
<b>CLASS LCL_TREE_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS: HANDLE_NODE_CM_REQ
FOR EVENT NODE_CONTEXT_MENU_REQUEST OF CL_GUI_ALV_TREE
IMPORTING NODE_KEY MENU.
ENDCLASS. </b>
<b>CLASS LCL_TREE_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_NODE_CM_REQ.
CALL METHOD MENU->CLEAR.
CALL METHOD MENU->ADD_FUNCTION
EXPORTING
FCODE = 'DEL_SUBTREE'
TEXT = 'Delete Subtree'. "Delete Subtree
CALL METHOD MENU->ADD_FUNCTION
EXPORTING
FCODE = 'ADD_SUBTREE'
TEXT = 'Add Subtree'. "Add Subtree</b>
Then we handle the node that is selected by the user.
Now our problem is can the context menu be created dynamically based on the node selected.
For example:
If my ALV Tree is
<b>Node A
>Node B
>>Node C
>Node B
>>Node C</b>
So, if I right click on Node A, I should get only 'Add B' or 'Delete B'.
if I click on Node B, I should get 'Add C' or 'Delete C'.
Depending on the node on which I right click the context menu should change. How to achieve that.
regards,
Raju.
‎2007 Jan 25 1:39 PM
Hi,
The method HANDLE_NODE_CM_REQ FOR EVENT NODE_CONTEXT_MENU_REQUEST has NODE_KEY as importing paramer.
Use that NODE_KEY in method GET_OUTTAB_LINE' and get the node details.
Based on that you use 'Add Function' to have a relevant context menu.
Use Method GET_FIRST_CHILD to identify the child nodes.
Hope this helps
Regards
Immanuel D
‎2007 Jan 25 1:39 PM
Hi,
The method HANDLE_NODE_CM_REQ FOR EVENT NODE_CONTEXT_MENU_REQUEST has NODE_KEY as importing paramer.
Use that NODE_KEY in method GET_OUTTAB_LINE' and get the node details.
Based on that you use 'Add Function' to have a relevant context menu.
Use Method GET_FIRST_CHILD to identify the child nodes.
Hope this helps
Regards
Immanuel D