Event Handling Using Static Methods

Prerequisites

When you have declared the events of the office application that you want to react to in your ABAP program, you must create the processing logic for events. You create this in a local class containing a series of methods (either static or instance methods). Each method covers one process relevant for document processing.

Procedure


  1. Create the class definition, in which you declare the class methods for the event interpretation:

    CLASS c_event_handler DEFINITION.
    PUBLIC SECTION.
    CLASS-METHODS: close_event
    FOR EVENT ON_CLOSE_DOCUMENT OF I_OI_DOCUMENT_PROXY
    IMPORTING (...).
    CLASS-METHODS: custom_event
    FOR EVENT ON_CUSTOM_EVENT OF I_OI_DOCUMENT_PROXY
    IMPORTING (...).
    ENDCLASS.
  2. Implement the static methods:

    CLASS c_event_handler IMPLEMENTATION.
    METHOD close_event.
    <Processing logic>
    ENDMETHOD.
    METHOD custom_event.
    <Processing logic>
    ENDMETHOD.
    ENDCLASS.