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

Former Member
0 Likes
1,020

does static events can be triggered only by static methods or it can be triggered both by static as well as instance methods.similarly,does the instance events can be triggered by static methods.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
737

Hi

At the moment of implementation, a class defines its:

Instance events (using the EVENTS statement)

   Static events (using the CLASS-EVENTS statement)

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: METHODS . (for static events)

A class or instance can trigger an event at runtime using the RAISE EVENT statement.

Both instance and static events can be triggered in instance methods.

Only static events can be triggered in static methods.

Events can only have EXPORTING parameters which must be passed by value.

Triggering an event using the statement RAISE EVENT has the following effect:

- The program flow is interrupted at that point

- The event handler methods registered to this event are called and

- processed Once all event handler methods have been executed, the program flow continues

REWARD IF USEFULL

3 REPLIES 3
Read only

Former Member
0 Likes
738

Hi

At the moment of implementation, a class defines its:

Instance events (using the EVENTS statement)

   Static events (using the CLASS-EVENTS statement)

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: METHODS . (for static events)

A class or instance can trigger an event at runtime using the RAISE EVENT statement.

Both instance and static events can be triggered in instance methods.

Only static events can be triggered in static methods.

Events can only have EXPORTING parameters which must be passed by value.

Triggering an event using the statement RAISE EVENT has the following effect:

- The program flow is interrupted at that point

- The event handler methods registered to this event are called and

- processed Once all event handler methods have been executed, the program flow continues

REWARD IF USEFULL

Read only

Former Member
0 Likes
737

Hi ,

Declaring Events

You declare events in the declaration part of a class or in an interface. To declare instance events, use the following statement:

EVENTS evt EXPORTING... VALUE(e1 e2 ...) TYPE type [OPTIONAL]..

To declare static events, use the following statement:

CLASS-EVENTS evt...

Both statements have the same syntax.

When you declare an event, you can use the EXPORTINGaddition to specify parameters that are passed to the event handler. The parameters are always passed by value. Instance events always contain the implicit parameter SENDER, which has the type of a reference to the type or the interface in which the event is declared.

Triggering Events

An instance event in a class can be triggered by any instance method in the class. Static events can be triggered by any method. However, static methods can only trigger static events. To trigger an event in a method, use the following statement:

RAISE EVENT evt EXPORTING e1 = f1 e2 = f2 ...

Thanks and Best Regards,

Vinoth

Read only

varma_narayana
Active Contributor
0 Likes
737

Hi Sandeep.

Static Events can be triggered by either Static methods or Instance methods.

But Instance Events can be only triggered by instance methods. Bcoz they cannot be triggered without creating an instance.

This rule is applicable for all the Static components . Not only events.

<b>reward if Helpful</b>