Publishing Callback 

Use

You use the callback to return the responsibility for determining the object to generic object services. For this, the services call a method that you have implemented. At runtime, your application only publishes the callback.

Procedure

  1. Implement the interface method if_gos_callback~get_object in a local class:
  2.  

    class lcl_myclass definition.

    interfaces if_gos_callback.

    endclass.

     

    class lcl_myclass implementation.

    method if_gos_callback~get_object.

    endmethod.

    endclass.

     

  3. Program the callback (more precise: the publication of the callback)

 

data: go_myobject type ref to cl_gos_manager,

lo_callback type ref to lcl_myclass

create object lo_callback.

create object go_myobject

exporting io_callback = lo_callback

exceptions others = 1

Result

At runtime, the following now happens:

  1. Your application publishes the callback and provides an instance of your local class lcl_myclass.
  2. As soon as the user demands the menu of available services, method get_object is called from your local class and thus determines the current object.
  3. The button for the toolbox is inserted at the top of the screen (GUI).