21.03.2013 Views

Object Oriented ABAP

Object Oriented ABAP

Object Oriented ABAP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Event Handler Technique in <strong>Object</strong> oriented <strong>ABAP</strong><br />

Event is a mechanism by which method of one class can raise method of another class,<br />

without the hazard of instantiating that class. It provides to raise the method (event handler<br />

method) of one class with help of another method in the same or different class (triggering<br />

method).<br />

The below steps is required to have the event handler in the class:-<br />

Create an event in a class.<br />

Create a triggering method in the same class which will raise the event.<br />

Create an event handler method for the event in same/other class.<br />

Register the event handler method in the program.<br />

Now, the above settings are complete for event handler in class. Create an object from the<br />

class containing the event and call the triggering method to raise the event.<br />

By taking the above steps, the following sample examples will demonstrate the event<br />

handler technique in Class.<br />

1. Events with Handler Method in the same class.<br />

This example tells that how to raise method, if the triggering method and event handler<br />

method presents in the same class.<br />

Sample code and Output.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!