Event Handling Using Instance 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
-
Create the class definition, in which you declare the methods for the event interpretation:
CLASS class_event_handler DEFINITION. PUBLIC SECTION. METHODS: close_event FOR EVENT ON_CLOSE_DOCUMENT OF I_OI_DOCUMENT_PROXY IMPORTING (...). METHODS: custom_event FOR EVENT ON_CUSTOM_EVENT OF I_OI_DOCUMENT_PROXY IMPORTING (...). ENDCLASS.
-
Implement the methods:
CLASS event_handler IMPLEMENTATION. METHOD close_event. <Processing logic> ENDMETHOD. METHOD custom_event. <Processing logic> ENDMETHOD. ENDCLASS.