Event detection

Event detection refers to the collection of processes that notify the adapter of SAP application object events. Notification includes, but is not limited to, the type of the event (object and operation) and the data key required for the external system to retrieve the associated data.

Event detection is the process of identifying that an event was generated in the SAP application. Typically, adapters use database triggers to detect an event. However, because the SAP application is tightly integrated with the SAP database, SAP allows very limited access for direct modifications to its database. Therefore, the event-detection mechanisms are implemented in the application transaction layer above the database.

Adapter-supported event detection mechanisms

The four event-detection mechanisms that are supported by the adapter are described in the following list:
  • Custom Triggers, which are implemented for a business process (normally a single SAP transaction) by inserting event detection code at an appropriate point in the SAP transaction
  • Batch programs, which involve developing an ABAP program containing the criteria for detecting an event
  • Business workflows, which use the object-oriented event detection capabilities of SAP
  • Change pointers, a variation of business workflows, which use the concept of change documents to detect changes for a business process

All these event-detection mechanisms support real-time triggering and retrieval of objects. In addition, custom triggers and batch programs provide the ability to delay the retrieval of events. An event whose retrieval is delayed is called a future event.

Each event detection mechanism has advantages and disadvantages that need to be considered when designing and developing a business object trigger. Keep in mind that these are only a few examples of event detection mechanisms. There are many different ways to detect events.

After you determine the business process to support (for example, sales quotes or sales orders) and determine the preferred event-detection mechanism, implement the mechanism for your business process.

When implementing an event detection mechanism, it is a good idea to support all of the functions for a business process in one mechanism. This limits the effect in the SAP application and makes event detection easier to manage.

Event table

Events that are detected are stored in an SAP application table. This event table is delivered as part of the ABAP component. The event table structure is as follows.
Table 1. Event table fields
Name Type Description
event_id NUMBER Unique event ID that is a primary key for the table.
object_name STRING Business object name.
object_key STRING Delimited string that contains the keys for the business object.
object_function STRING Operation corresponding to the event (Delete, Create, or Update).
event_priority NUMBER Any positive integer to denote the priority of the event.
event_time DATE Date and time when the event was generated.
event_status NUMBER Event processing status. Possible values are:
  • 0 - Ready for poll
  • 1 - Event delivered
  • 2 - Event prequeued
  • 3 - Event in progress
  • 4 - Event locked
  • -1 - Event failed
Xid STRING Unique XID (transaction ID) value for assured-once delivery.
event_user STRING User who created the event.
event_comment STRING Description of the event.