Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Events in Abap Objects

Former Member
0 Likes
1,043

What are events. how to create and handle this events.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
754

Triggering Events

RAISE EVENT <evt> EXPORTING... <ei> = <fi>...

The self-reference ME is automatically passed to the implicit parameter SENDER.

Handling Events

Events are handled using special methods. To handle an event, a method must

1. be defined as an event handler method for that event

2. be registered at runtime for the event.

Declaring Event Handler Methods

METHODS <meth> FOR EVENT <evt> OF <cif> IMPORTING.. <ei>..

The event handler method does not have to use all of the parameters passed in the RAISE EVENT statement.

If you want the implicit parameter SENDER to be used as well, you must list it in the interface.

Registering Event Handler Methods

SET HANDLER... <hi>... [FOR]...

Handler methods are executed in the order in which they were registered.

4 REPLIES 4
Read only

Former Member
0 Likes
755

Triggering Events

RAISE EVENT <evt> EXPORTING... <ei> = <fi>...

The self-reference ME is automatically passed to the implicit parameter SENDER.

Handling Events

Events are handled using special methods. To handle an event, a method must

1. be defined as an event handler method for that event

2. be registered at runtime for the event.

Declaring Event Handler Methods

METHODS <meth> FOR EVENT <evt> OF <cif> IMPORTING.. <ei>..

The event handler method does not have to use all of the parameters passed in the RAISE EVENT statement.

If you want the implicit parameter SENDER to be used as well, you must list it in the interface.

Registering Event Handler Methods

SET HANDLER... <hi>... [FOR]...

Handler methods are executed in the order in which they were registered.

Read only

Former Member
0 Likes
754

Hi Raju ,

What event are you refering to , event in ALV?

In general you need to define and inplemnent a class with methods which will be triggered when the event occurs , and to activate this you need to set handlers which sense or catch these event hence result in the method to be exeucted.

Regards

Arun

Read only

Former Member
0 Likes
754

HI,

By triggering an event, an object or a class announces a change of state, or that a certain state has been achieved.Events link objects or classes more loosely than direct method calls do. Method calls establish precisely when and in which statement sequence the method is called. However, with events, the reaction of the object to the event is determined by the triggering of the event itself.

Events are most often used in GUI implementations.Other external object models, such as COM, ActiveX Controls etc, also provide events.

At the moment of implementation, a class defines its instance events (using the statement EVENTS) and static events (using the statement CLASS-EVENTS)

Classes or their instances that receive a message when an event is triggered at runtime and want to react to this event define event handler methods.

Statement : (CLASS-)METHODS | FOR ALL INSTANCES.

Every object that has defined events has an internal table: the handler table. All objects that have registered for events are entered in this table together with their event handler methods.Objects that have registered themselves for an event that is still “live” also remain “live”. The methods of these objects are called when the event is triggered, even if they can no longer be reached using main memory references.

If several objects have registered themselves for an event, then the sequence in which the event handler methods are called is not defined, that is, there is no guaranteed algorithm for the sequence in which the event handler methods are called.

If a new event handler is registered in an event handler method for an event that has just been triggered, then this event handler is added to the end of the sequence and is then also executed when its turn comes.

If an existing event handler is deregistered in an event handler method, then this handler is deleted from the event handler method sequence.

Events are also subject to the visibility concept and can therefore be either public, protected or private. Visibility establishes authorization for event handling :

­ all users

­ only users within that class or its subclasses

­ only users in that class.

Event handler methods also have visibility characteristics. Event handler methods, however, can only have the same visibility or more restricted visibility than the events they refer to.

The visibility of event handler methods establishes authorization for SET-HANDLER statements: SET HANDLER statements can be made

anywhere

in that class and its subclasses

only in that class

Regards,

Balaji Reddy G

**Rewards if answers are useful