REPORT YSUBOOPS7 .
CLASS c1 DEFINITION.
PUBLIC SECTION.
* Creating event : E1
EVENTS: E1.
* Creating an event handling method.
METHODS: M1 FOR EVENT E1 OF c1.
* Method to raise the event
METHODS : T1.
ENDCLASS.
CLASS C2 DEFINITION.
PUBLIC SECTION.
* Creating an event handling method.
METHODS: M2 FOR EVENT E1 OF c1.
endclass.
CLASS c1 IMPLEMENTATION.
* Method : T1 will raise the event
METHOD : T1.
write:/5 'I am T1, going to raise event E1'.
raise event E1.
ENDMETHOD.
* Method : M1 will be called when the event is raised
METHOD : M1.
write:/5 ' I am the event handler method M1 in c1'.
ENDMETHOD.
ENDCLASS.
class c2 implementation.
* Method : M2 will be called when the event is raised
METHOD : M2.
write:/5 ' I am the event handler method M2 in c2'.
ENDMETHOD.
endclass.
Start-of-selection.
Data: oref1 type ref to c1,
oref2 type ref to c2.
Create object: oref1 , oref2 .
* Registering the event handler method
SET HANDLER oref1->M1 FOR oref1 .
* Calling the event which will raise the event.
call method oref1->T1.
* De-Registering the earlier event handler method
SET HANDLER oref1->M1 FOR oref1 ACTIVATION space .
* Registering the new event handler method
SET HANDLER oref2->M2 FOR oref1 .
* Calling the event which will raise the event.
call method oref1->T1.
Output:
I am T1, going to raise event E1
I am the event handler method M1 in c1
I am T1, going to raise event E1
I am the event handler method M2 in c2
Welcome To My BLOG
This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me
Please vote for my Blog. And please input me on this mail addrssess.Email me
Share this link with your friends
http://www.rebtel.com/u/15163104576
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment