Get Example source ABAP code based on a different SAP table
• FOR SET HANDLER • FOR ALL INSTANCES SET HANDLER • ACTIVATION SET HANDLER
SET HANDLER>, FOR> Short Reference >
ABAP_SYNTAX SET HANDLER handler1 handler2 ... FOR ${ oref $|${ALL INSTANCES$} $} > $[ACTIVATION act$].>
ABAP Addition 1 ... FOR oref> 2 ... FOR ALL INSTANCES> 3 ... ACTIVATION act>
What does it do? This statement registers the event handlers> handler1 handler2 ...> for the associated instance events > of the objects specified after FOR>. The addition ACTIVATION> can be used to deregister event handlers or perform a dynamic registration. An event handler is executed if the associated instance event is raised using RAISE EVENT>> in an object for which it is registered. An event handler handler> can be specified as follows, where the names have the same meaning as in the explicit method call>:
meth>
oref->meth>
class=>meth> Methods meth> can be specified from the same class or from other classes defined as instance event handlers using the addition FOR EVENT evt OF {class|intf}> of the statements $[CLASS-$]>> METHODS>>. No event handlers for static events> can be specified. At least one name must be specified. The type class> or intf> specified after FOR EVENT OF > in the definition of an instance event handler specifies the objects whose events it can handle. Single objects or all handleable objects can be specified after the addition FOR>.
ABAP Addition
What does it do? This addition registers or deregisters the event handlers of the list handler1 handler2 ...> for exactly one object. oref> is an object reference that must point to an object whose events can be handled by the specified event handlers. The class of the object must be class> or a subclass of class>, or must implement the interface intf> directly or through a superclass. oref> is a functional operand position>.
ABAP_EXAMPLE_VX5 Registration of an event handler for an ALV event. ABEXA 00651 ABAP_EXAMPLE_END
ABAP Addition
What does it do? This addition registers or deregisters the event handlers of the list handler1 handler2 ...> for all objects whose events they can handle. These are all objects whose classes are either class> or the subclass of class>, or which implement the interface intf> directly or through a superclass. Such a registration also applies to all raising instances created after the statement SET HANDLER>.
Latest notes: Registration with FOR ALL INSTANCES> applies also in particular to temporary instances that can be created when using the instantiation operator NEW>> . NON_V5_HINTS ABAP_HINT_END
ABAP Addition
What does it do? A single-character text-like field act> can be specified after the addition ACTIVATION>. If act> has the value X (the default value), the event handlers handler> are registered. If act> has the value blank, however, the registration of the event handlers handler> is canceled. A single registration cannot, however, be deregistered using mass deregistration. Conversely, individual raising objects cannot be excluded from registration after a mass registration.
Latest notes: As long as the registration of an instance method as an event handler for an instance event is not canceled using ACTIVATION ' '> or all raising instances are deleted, the associated object cannot be deleted by the Garbage Collector>. This is because it is still used by the runtime framework. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Registration of an event handler with FOR ALL INSTANCES>. The events of all temporary instances created with NEW>> are handled until registration is stopped. The code is taken from class CL_DEMO_SET_HANDLER_FOR_ALL>> and can be executed there. ABEXA 00652 ABAP_EXAMPLE_END