Show TOC

Procedure documentationPublishing Object and Offering Context Menu Locate this document in the navigation structure

 

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.

    Syntax Syntax

    1. data:	go_myobject type ref to cl_gos_manager.
      …
      create object go_myobject.
      
    End of the code.
  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.

    Syntax Syntax

    1. 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.
      
    End of the code.
  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:

    Syntax Syntax

    1. call method go_myobject->dispatch_menu_command
      	importing	ip_fcode = lp_fcode
      			io_menu = lo_menu.
      
    End of the code.

    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.