Show TOC

Publishing Object and Offering Context MenuLocate this document in the navigation structure

Context

This procedure allows you to publish your object and to offer the object services in the context menu of the object. Users do not call the services from the toolbox, but rather by right mouse-clicking.

Procedure


  1. Generate an instance of class cl_gos_manager. However, do not transfer the BOR-ID or the callback class so that no object is published.

    data:      go_myobject type ref to cl_gos_manager.
    …
    create object go_myobject.
    
                   
  2. You must create the context menu and also transfer the BOR-ID in order to publish the object.

    The import parameter lo_menu contains a reference to the context menu.

    data:      ...,
            lo_menu type ref to cl_ctmenu,
            ls_object type borident.
     …
     call method go_myobject->get_context_menu
            exporting       is_object = ls_object
            importing       eo_menu = lo_menu.
    
                   
  3. You can use the context menu in various controls. . Normally you write an Event Handler which forwards the menu entries selected by the user. In the event handler call the method dispatch_menu_command of the cl_gos_manager class for generic object services:

    call method go_myobject->dispatch_menu_command
            importing       ip_fcode = lp_fcode
                            io_menu = lo_menu.
    
                   

    You only have to request the import parameter lo_menu if you have requested more than one context menu within the same instance from cl_gos_manager.