Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 

Hello all,

          In my other document ( Simple event handling in ABAP OOPS ) I showed how to use the standard events which are present in standard classes (for ex. cl_gui_alv_grid). Sometimes we create our programs or reports by using our own custom classes. And in those classes we may or may not define events.

For this document the scenario is like this -

-> User will enter a value

-> If the value is between 1 - 8 it will give output

-> If value is lesser then 1 or greater then 8 , it will give a message

Create a report in SE38.

Declare two classes , one class will contain the working and event , and other one will contain the method to handle the event of first class.

As we can see that event is declared by declaring EVENT in a class. Our event is ' le_event '. We will try to give the message for wrong input using this event,

for that we will use RAISE EVENT statement. The method which we have declared in second will do the working whenever this event is raised.

Create the objects for the classes and we will register our method of second class as an event handler for our event.

Provide the implementation for our classes.

In implementation of first class, I have given RAISE EVENT statement in if-else condition. This statement will trigger the event and to handle this, method 'handle_le_event ' is used.

On execution it will work like this.

if value is between 1-8


For more better understanding please check the two documents which I have attached.