You are on page 1of 17

IBM Global Business Services

Defining and Registering Events in Object Oriented ABAP

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Agenda
Define and trigger events
Register and handle events

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Unit Objectives
Define and trigger events
Handle events
Register and deregister events
Receive a reference from the sender
Explain the conceptual differences between methods and events

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Overview

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Characteristics and Uses


Looser linkage than for a method call
Different communication model
Trigger does not know the user
Important for GUI implementation
Conformity to other object models
COM
ActiveX Controls
OpenDoc

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Triggering and Handling Events: Overview


Triggering events
Class defines event (EVENTS, CLASS-EVENTS)
Object or class triggers event (RAISE EVENT)

Handling events
Event handler class defines and implements event handler method
([CLASS-]METHODS... FOR EVENT ... OF ...)
Event handler object or handler class registers itself to specific object/class events
at runtime (SET HANDLER)

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Defining and Triggering Events: Syntax

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Handling and Registering Events

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Handling Events: Syntax

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Registering for an Event: Syntax

10

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Deregistration and the Implicit Reference SENDER

11

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Registration/Deregistration: Handler Table

12

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Defining View Layout


Event handling is sequential.
Sequence in which event handler methods are called is not defined.
As far as the Garbage Collector is concerned, registration has the same effect
as a reference to the object registered.
Registered objects are never deleted.
Immediate effects of SET HANDLER on event handler
methods:
Newly registered event handlers are also executed.
Deregistered handlers may already have been executed.

13

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Events and Visibility


The visibility of an event establishes authorization for event handling.
The visibility in an event handler method establishes authorization for SET-HANDLER
statements.
An event handler method must have either the same or more restricted visibility than
the event it refers to :

14

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Events: Unit summary


You are now able to:
Define and trigger events
Handle events
Register and deregister events
Explain the conceptual differences between
methods and events

15

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Hands-on Exercise 8
Objectives:
Define and trigger events
Handle events
Register for events

16

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

IBM Global Business Services

Thank You
Questions?

17

Developing User Interfaces with Web Dynpro for ABAP | Jan-2011

Copyright
IBM Corporation 2007
2013

You might also like