Skip to end of metadata
Go to start of metadata

The intent behind the Observer Design Pattern is to define a dependecy between objects so that when main object changes its state, all the dependent objects are notified. Its upto the dependent objects to update themselves or ignore the notification.

Design time consideration:

  1. In the main object, AKA Subject, create a Event. Also add create a signature to the event.
  2. Create class with Event Handler method for the event of the Subject.
  3. Inherit the Subclasses for different behavior. Redefine the event handler method for which any behavior is required.
  4. Register the event handler using the statement SET EVENT HANDLER ... FOR O_SUBJECT.Follow this ABAP Objects Design Patterns – Observer for more information (NOTE: Outside SDN Link).

Case Study: Usage of Observer in real world

Smaller version of the demo which shows the real world example of the Observer while working with Multiple ALVs. Follow Case Study: Observer Design Pattern Usage for more details. (NOTE: Outside SDN Link).