2008 Sep 24 11:27 AM
Hi ,
Can anybody give some example of creating a local class which should have methods and events.
Regds,
khadeer.
2008 Sep 24 12:23 PM
Go to SE38 and look at DEMO_ABAP_OBJECTS. This program demonstrates, objects and object references, inheritance, interfaces and event.
enjoy
2008 Sep 24 11:56 AM
2008 Sep 24 12:14 PM
2008 Sep 24 12:15 PM
Hi...
this is a very simple program, which will just let you know the logic of the processing.. hope it helps, and later you can add on to this....
----
CLASS c1 DEFINITION
----
*
----
class c1 definition.
public section.
methods : m1, m2.
events : e1.
endclass. "c1 DEFINITION
----
CLASS c1 IMPLEMENTATION
----
*
----
class c1 implementation.
method m1.
write : /'simple method executed'.
endmethod. "m1
method m2.
write : /'before raising the event'.
raise event e1. " event raised.
write : /'after the event'.
endmethod. "m2
endclass. "c1 IMPLEMENTATION
----
CLASS cl_events DEFINITION
----
*
----
class cl_events definition.
public section.
methods : m_event for event e1 of c1.
endclass. "cl_events DEFINITION
----
CLASS cl_events IMPLEMENTATION
----
*
----
class cl_events implementation.
method m_event.
write : /'the event handler method.....'.
endmethod. "m_event
endclass. "cl_events IMPLEMENTATION
data: oref type ref to c1, oevent type ref to cl_events.
start-of-selection.
create object oref.
create object oevent.
set handler oevent->m_event for all instances.
oref->m1( ).
oref->m2( ).
2008 Sep 24 12:16 PM
Hi Khadeer,
Please check this link
http://www.erpgenie.com/abap/OO/eg.htm
For more please check this thread
Check this pdf as well
Hope this would help you.
Good luck
Narin
2008 Sep 24 12:23 PM
Go to SE38 and look at DEMO_ABAP_OBJECTS. This program demonstrates, objects and object references, inheritance, interfaces and event.
enjoy