‎2008 Aug 01 10:25 AM
Hi,
What shall we need to do, to use events in oops to generate a report. Do we need to write a local class?Please can anybody explain with an example?
Rgds,
Khadeer.
‎2008 Aug 01 10:30 AM
hi Basha..
Normally v use reporting events...
but frequently use START-OF-SELECTION .
if u have selectin screen , u use all SELECTION SCREEN EVENT..
my program being without selectin scree i am not using selection screen events..
EX :
report z_dr_oop1.
----
CLASS first_class DEFINITION
----
*
----
class first_class definition.
public section.
data : var1 type i.
class-data : var2 type i.
methods : check.
protected section.
private section.
endclass. "first_class DEFINITION
----
CLASS FIRST_CLASS IMPLEMENTATION
----
*
----
class first_class implementation.
method : check.
do 5 times.
var1 = var1 + 1.
var2 = var1.
enddo.
endmethod. ":
endclass. "FIRST_CLASS IMPLEMENTATION
initialization.
data : out_var1 type i,
out_var2 type i.
data : ff type ref to first_class.
start-of-selection.
create object ff.
call method ff->check.
out_var1 = ff->var1. " only if PUBLIC ATTRIBUTES
out_var2 = first_class=>var2. " only if PUBLIC ATTRIBUTES
write : / 'INSTANCE ==> ',out_var1,
/ 'STATIC ===> ',out_var2.
‎2008 Aug 01 10:30 AM
hi Basha..
Normally v use reporting events...
but frequently use START-OF-SELECTION .
if u have selectin screen , u use all SELECTION SCREEN EVENT..
my program being without selectin scree i am not using selection screen events..
EX :
report z_dr_oop1.
----
CLASS first_class DEFINITION
----
*
----
class first_class definition.
public section.
data : var1 type i.
class-data : var2 type i.
methods : check.
protected section.
private section.
endclass. "first_class DEFINITION
----
CLASS FIRST_CLASS IMPLEMENTATION
----
*
----
class first_class implementation.
method : check.
do 5 times.
var1 = var1 + 1.
var2 = var1.
enddo.
endmethod. ":
endclass. "FIRST_CLASS IMPLEMENTATION
initialization.
data : out_var1 type i,
out_var2 type i.
data : ff type ref to first_class.
start-of-selection.
create object ff.
call method ff->check.
out_var1 = ff->var1. " only if PUBLIC ATTRIBUTES
out_var2 = first_class=>var2. " only if PUBLIC ATTRIBUTES
write : / 'INSTANCE ==> ',out_var1,
/ 'STATIC ===> ',out_var2.
‎2008 Aug 01 10:34 AM
‎2008 Aug 01 10:43 AM
Please look at this program on your System.
BCALV_TEST_GRID_EVENTS
Regards,
Shailaja
‎2008 Aug 01 10:46 AM
hi,
A Report is generates with the help of REPORT program Events.
YOu can use OOPS Classes and inside those Events you can call the methods of the class and even trigger the Events of the Class and process the Report Program.
Regards
Sumit Agarwal
‎2008 Aug 01 10:48 AM
Hi Khadeer.
I would like to suggest,
A Method triggers an Event.
In turn certain Methods react to this triggering of events.
Hence, These Methods which react to the triggering are called as Handlers.
I would like to suggest a reference,
[SAP HELP - Standard Reference for Triggering and Handling Events - Overview Graphic|http://help.sap.com/saphelp_erp2004/helpdata/en/fc/eb2c67358411d1829f0000e829fbfe/content.htm]
[SAP HELP - Standard Reference for Triggering and Handling Events|http://help.sap.com/saphelp_erp2004/helpdata/en/71/a8a77955bc11d194aa0000e8353423/content.htm]
[SAP HELP - Standard Reference for Triggering and Handling Events - Events: Introductory Example|http://help.sap.com/saphelp_erp2004/helpdata/en/53/414326127f11d3b9390000e8353423/content.htm]
[SAP HELP - Standard Reference for Events in ABAP Objects - Advanced Example |http://help.sap.com/saphelp_erp2004/helpdata/en/41/7af4eca79e11d1950f0000e82de14a/content.htm]
Local classes can only be instantiated in the methods of the global class, Refer,
[SAP HELP - Standard Reference for Local Classes in Class Pools - Class Pools|http://help.sap.com/saphelp_erp2004/helpdata/en/ec/d9ab291b0b11d295400000e8353423/content.htm]
Hope that's usefull.
Good Luck & Regards.
Harsh Dave