2007 Jul 25 4:27 PM
Hi,
I am trying to handle an event thrown by a fatal exception. I am able to capture the event in this event handler method. However, I need to access the PREVIOUS of the exception in this event handler method and am not sure how to do it.
Can some one please help with this?
Thanks
Saravanan.
2007 Jul 25 5:09 PM
Hi,
Maybe you can use the object SENDER that the event export. Sender is a object reference for the previous objects.
Exemle:
methods USER_COMMAND
for event USER_COMMAND of ZCL_MAR_MVC_CONTROLLER
importing UCOMM SENDER.
Regards.
Marcelo Ramos
Hi,
Maybe you can use the object SENDER that the event export. Sender is a object reference for the previous objects.
Exemle:
methods USER_COMMAND
for event USER_COMMAND of ZCL_MAR_MVC_CONTROLLER
importing UCOMM SENDER.
Regards.
Marcelo Ramos
2007 Jul 25 5:09 PM
Hi,
Maybe you can use the object SENDER that the event export. Sender is a object reference for the previous objects.
Exemle:
methods USER_COMMAND
for event USER_COMMAND of ZCL_MAR_MVC_CONTROLLER
importing UCOMM SENDER.
Regards.
Marcelo Ramos
2007 Jul 25 5:28 PM
Hi Marcelo,
Thanks so much.
Unfortunately this event does not have any parameters defined and is not easily modifyable. Is it possible to acces the info in this case?
Thanks
Saravanan.
2007 Jul 25 7:05 PM
Hi,
Look at this code end check if your program works in the similar way.
Here, i'm changing an atribute from one class from other class.
If it doesn't works and you can't change an atribute directelly, i really don't know other way to do this.
----
CLASS main DEFINITION
----
CLASS main DEFINITION.
PUBLIC SECTION.
EVENTS evt EXPORTING value(e_data) TYPE char01.
METHODS event_trigger.
METHODS set_data IMPORTING i_data TYPE char01.
PRIVATE SECTION.
DATA v_data TYPE char01 VALUE 'X'.
ENDCLASS.
----
CLASS main IMPLEMENTATION
----
CLASS main IMPLEMENTATION.
METHOD event_trigger.
RAISE EVENT evt EXPORTING e_data = v_data.
ENDMETHOD.
METHOD set_data.
MOVE i_data TO v_data.
WRITE: / 'New v_data value ->', v_data.
ENDMETHOD.
ENDCLASS.
----
CLASS second DEFINITION
----
CLASS second DEFINITION.
PUBLIC SECTION.
METHODS event_handler FOR EVENT evt OF main IMPORTING e_data sender.
ENDCLASS.
----
CLASS second IMPLEMENTATION
----
CLASS second IMPLEMENTATION.
METHOD event_handler.
WRITE: 'v_data value ->', e_data.
CALL METHOD sender->set_data( i_data = 'Y' ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: obj_main TYPE REF TO main.
DATA: obj_second TYPE REF TO second.
CREATE OBJECT: obj_main, obj_second.
SET HANDLER obj_second->event_handler FOR obj_main.
call method obj_main->event_trigger( ).
Regards.
Marcelo Ramos
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |