‎2010 Apr 15 11:02 AM
HI,
I'm using the class CL_SALV_TREE inorder to show a screen like tree stucture..now i wanna add a context menu on that tree
structure..
is it possible to add a context menu.if so can u explain the steps how to do it?...
Thanks in advance,
poornima.
‎2010 Apr 16 4:59 AM
Hi,
There is a demo program which can give you a good example as to how to implement the context menu. Have a look at it.
SAPSIMPLE_TREE_CONTEXT_MEN_DEM package - SEU_TREE_CONTROL.
Hope this will help.
Thanks,
Samantak.
‎2010 Apr 16 5:12 AM
hi,
thanks for ur reply..but the thing is the program which u gave was implemented using the class cl_gui_simple_tree ,so it contains
default context menu method..but in my program i'm using the class CL_SALV_TREE,CL_SALV_EVENTS_TREE..
my question is how come we can implement the context menu for this class which doesnt have default context menu method..
is it possible to intergate some other events..if it so plz tell me..
Thanks ,
Poornima
‎2010 Apr 19 12:04 PM
Hi,
Can you have a look at this Demo Report Program : BCALV_TREE_03. Package - SLIS.
Hope this will help you.
Thanks,
Samantak.
‎2010 Apr 16 7:41 AM
hi,
Use CL_CTMENU for context menu.
Use can also try CL_COLUMN_TREE_MODEL for creating tree structure.
‎2010 Apr 20 2:22 PM
CL_SALV_TREE creates a Tree type reference to the class CL_SALV_GUI_TREE which is inherited from the class CL_GUI_ALV_TREE. So, to get the Context Menu on the tree created by the CL_SALV_TREE, you need to :
Define Event Receiver class:
class lcl_handle_events definition.
public section.
on_header_context_menu_req for EVENT header_context_menu_request of cl_gui_alv_tree " <<
IMPORTING FIELDNAME
menu.
endclass. "lcl_handle_events DEFINITION
Implement the class:
class lcl_handle_events implementation.
method on_header_context_menu_req.
* Access the MENU object
ENDMETHOD.
endclass. "lcl_handle_events IMPLEMENTATION
Now, here is the trick. Set the Event Handler for ALL INSTANCE rather than setting it for the specific instance before calling the DISPLAY method.
data: gr_events type ref to lcl_handle_events.
SET HANDLER gr_events->on_header_context_menu_req FOR ALL INSTANCES . "mr_column_tree.
*... §5 display the table
gr_tree->display( ).
Same way, you can try to trap the other Context Menu events like ITEM_CONTEXT_MENU_REQUEST, ITEM_CONTEXT_MENU_SELECTED.
Regards,
Naimesh Patel