Event can have export parameters which are passed to the event handler method by that event. Here the handler methods need to be declared with importing parameters. The names of those importing parameters will be similar to the exporting parameters of the event. Triggering methods can only pass the value to those parameters by using RAISE EVENT statement. Hence at the time of raise event the triggering method can pass values to the parameters.
REPORT zevent_export.
*----------------------------------------------------------------------*
* CLASS ABC DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS abc DEFINITION.
PUBLIC SECTION.
DATA v_txt TYPE char50.
EVENTS:
evnt1 EXPORTING VALUE(txt1) TYPE char50
VALUE(txt2) TYPE char50,
evnt2 EXPORTING VALUE(txt3) TYPE char50
VALUE(txt4) TYPE char50.
METHODS:
hand1 FOR EVENT evnt1 OF abc IMPORTING txt1 txt2,
hand2 FOR EVENT evnt2 OF abc IMPORTING txt3 txt4,
trig1,
trig2.
ENDCLASS. "ABC DEFINITION
*----------------------------------------------------------------------*
* CLASS ABC IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS abc IMPLEMENTATION.
METHOD hand1.
v_txt = 'First Event Handler Method'.
WRITE: / v_txt,
/ txt1,
/ txt2.
SKIP.
ENDMETHOD. "hand1
METHOD hand2.
v_txt = 'Second Event Handler Method'.
WRITE: / v_txt,
/ txt3,
/ txt4.
SKIP.
ENDMETHOD. "hand2
METHOD trig1.
v_txt = 'First Triggering Method'.
WRITE / v_txt.
RAISE EVENT evnt1 EXPORTING txt1 = '1st Variable of 1st Event'
txt2 = '2nd Variable of 1st Event'.
ENDMETHOD. "trig1
METHOD trig2.
v_txt = 'Second Triggering Method'.
WRITE / v_txt.
RAISE EVENT evnt2 EXPORTING txt3 = '1st Variable of 2nd Event'
txt4 = '2nd Variable of 2nd Event'.
ENDMETHOD. "trig2
ENDCLASS. "ABC IMPLEMENTATION
* Start of selection
START-OF-SELECTION.
* Data Declaration
DATA obj TYPE REF TO abc.
* Object creation
CREATE OBJECT obj.
* Set handler
SET HANDLER: obj->hand1 FOR obj,
obj->hand2 FOR obj.
* Trigger method
CALL METHOD: obj->trig1,
obj->trig2.