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
716

Hi

Any one can say

How to handle events in ABAP Object ?

Because Class contains of Variables, Methods & Events .

Thanks in Advance

Regards

Shriraam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
678

hi,

plz go through the link...U will get idea about handle the events...

[http://help.sap.com/saphelp_nw70/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm]

Regards,

Arun.

hi,

plz go through the link...U will get idea about handle the events...

[http://help.sap.com/saphelp_nw70/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm]

Regards,

Arun.

4 REPLIES 4
Read only

Former Member
0 Likes
679

hi,

plz go through the link...U will get idea about handle the events...

[http://help.sap.com/saphelp_nw70/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm]

Regards,

Arun.

Read only

MarcinPciak
Active Contributor
0 Likes
678

>

> Because Class contains of Variables, Methods & Events .

To be precise, variables are so called attributes

As for the events, refer [Triggering and Handling Events|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/71/a8a77955bc11d194aa0000e8353423/frameset.htm]

Regards

Marcin

Read only

Former Member
0 Likes
678

Hi,

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.

Check these this.

http://www.henrikfrank.dk/abapuk.html

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20ea...

Regards,

Arun.

Read only

uwe_schieferstein
Active Contributor
0 Likes
678

Hello Shriraam

Classes may have events which can be triggered.

Example: Class CL_GUI_ALV_GRID has events for double-clicking (DOUBLE_CLICK), hotspot (HOTSPOT_CLICK), changing the toolbar (TOOLBAR), and many more.

Class CL_GUI_ALV_GRID is somewhat special because all events are already registered meaning they are active. As soon as a user double-clicks on a row in an ALV list event DOUBLE_CLICK is triggered (or raised).

Raising an event means that the (instance of the) class tells the "outside" world that something has happened which might be of interest for "somebody".

If another class is interested in these events (i.e. wants to be "informed" as soon as an event is raised) this class has to register for the event. The ABAP command looks like this:


SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid.

LCL_EVENTHANDLER is a so-called event handler class (you can choose any name for it yet there are some best practices).

Using the SET HANDLER command method HANDLE_DOUBLE_CLICK registers for the corresponding event DOUBLE_CLICK of the instance go_grid (again, you can choose any name for the event handler method yet there are some best practices for naming).

As soon as a user double-clicks on a row in the ALV list of instance go_grid the OO Control Framework checks for all registered (and active) event handler methods which are then executed in random order.

Thus, the flow looks like this (simplified):


[1] Build ALV list
[2] PBO: Display ALV list
[3] User double-clicks on row
[4] Execute coding of all registered (and active) event handler methods
[5] Return back to displayed ALV list (do NOT pass PAI)
...

Hope this gives you some insights into events and event handling.

Regards

Uwe