Designing an event detection mechanism
You
can use many different mechanisms to detect events in the SAP application.
An event detection mechanism should have the ability to make a function
module call. The four event detection mechanisms that the connector
has implemented are:
- Code enhancement--implemented for a business process
(normally a single SAP transaction) by inserting event detection
code at an appropriate point within the SAP transaction
- Batch program--involves developing an ABAP program containing
the criteria for detecting an event
- Business workflow--uses SAP's own object-oriented event
detection capabilities
- Change pointer--implementing a change pointer mechanism,
which is a variation of business workflow, uses the concept of change
documents to detect changes for a business process
It is important that you determine the appropriate event detection
mechanism to implement for each business object that you develop,
because some may not be available for a particular business process.
Technical and functional knowledge of a particular business process
is necessary for each transaction for which you want to implement
event detection.
Review the following implementation considerations when determining
which event detection mechanism to implement for your business process.
- Availability
- Which event detection mechanisms are available for this business
process? This should be one of the first questions that you consider.
Code enhancement and batch program have high availability, whereas business
workflow and change pointer do not.
- Real-time integration
- Do events need to be detected synchronously? Do you need to
detect a large number of events at one time? All mechanisms except
batch program are suitable for real-time integration.
- Reliability
- Are all data changes for this business process detected when
generating an event? Code Enhancement, Batch Program, and Change
Pointer provide the best control of capturing all events of an object.
Business Workflow provides limited reliability. For example, Business
Workflow does not detect an address change during a Vendor transaction
update.
- Flexibility
- Do certain criteria need to be evaluated before an event is
triggered? Does an event need to be detected at a certain point
in the transaction? Code Enhancement is the most flexible, because
you can insert code at a specific point before event data is committed.
Change Pointer and Batch Program are moderately flexible, while
Business Workflow has very little flexibility in its implementation.
- Upgrade dependency
- Does an upgrade to the SAP application change the way an event
is detected for this business process? Typically, this is not known,
but business workflow and change pointer are affected by application changes
the most because they are under SAP's control.
- Difficulty
- Is time or level of difficulty an issue? Each mechanism has
its own level of implementation difficulty. In general, batch program
is the easiest. code enhancement and business workflow are moderately
more difficult, while change pointer is the most difficult because
it requires a more intimate knowledge of SAP and the business process
being evaluated.
- Future events
- Do you need to be able to capture an event real-time and then
delay its retrieval until a specified date? For example, an employee
record may be updated today with a change of address that is effective
three weeks from today. In this case, you may want to capture the event
at the time of the update, but delay its retrieval until the effective
date.
At this point, you should have an idea of the event detection
mechanisms that you need to consider. Use Table 49 as a general guideline in determining which mechanism
can be used for each business process you need to support.
Table 49. Event detection mechanism decision table
|
Code enhancement |
Batch program |
Business workflow |
Change pointer |
Availability |
High |
High |
Low |
Low |
Real-time integration |
Yes |
No |
Yes |
Yes |
Reliability |
High |
High |
Low |
Medium |
Flexibility |
High |
Medium |
Low |
Medium |
Upgrade dependency |
Low |
Low |
Medium |
Medium |
Difficulty |
Medium |
Low |
Medium |
High |
Future Events |
Yes |
Yes |
No |
No |
A final consideration to note is the development methodology
of your site. Perhaps event detection using only business workflow
is the preferred method and code enhancement cannot be used at all.
Using code enhancement is the recommended approach for event
detection because it is reliable, highly flexible, synchronous,
and has high availability. In contrast, business workflow and change
pointer mechanisms are not generally available for all business
processes. Batch program is typically used when real-time integration
is not desired.
Each event detection mechanism has advantages and disadvantages
for detecting an event in a business process. The following sections
give more detail about each of the event detection mechanisms, including
the main advantages and disadvantages of each.
All of the event detection mechanisms support real-time triggering
and retrieval of events. However, only code enhancement and batch
program provides the additional functionality of delayed retrieval.
An event specified to be retrieved at a later date is called a future
event.
Code enhancement
Code enhancement is implemented
at specific points in the code of an SAP transaction. By making
use of user exits, you can insert event detection code at the most
logical point in a transaction. The event detection code allows
for evaluation of criteria to determine whether an event is generated.
The general strategy of this mechanism is to insert your event
detection code when the data for a transaction is about to be committed
to the database.
Advantages
- Has access to SAP transactional information for the event detection
process
- Allows the insertion of event detection code at an appropriate
point of a transaction
- Provides synchronous event detection
- Limits the reliance on SAP functionality, so maintenance and
enhancements are easier
- Supports future events
Disadvantages
- User exits may not always be in the appropriate location in
the transaction
- SAP modification features may be necessary
Batch program
Batch program is useful when a large
number of events of the same type (such as customer orders) need
to be triggered, or a business process requires a large amount of
processing time. This mechanism does not require any modifications
to SAP-delivered code; however, you need to use (write) an ABAP
program that evaluates criteria for detecting events.
Advantages
- Can be implemented for most business processes
- Accurately detects events
- Is easy to implement
- Can be scheduled to run at a specific time if runtime resources
are an issue
- Supports future events
Disadvantages
- It does not provide synchronous event detection
- SAP transactional information is not available
- State (Create, Update, or Delete) or status changes cannot be
detected or may not be easily detected
- If a background job is created to automate a batch program,
an additional task needs to be maintained and monitored
Business workflow
Business workflow is a cross-application
tool within the SAP application that enables you to integrate business
tasks between applications. This tool supplements the existing business
functions of the SAP application. The standard functions of SAP
can be adapted using business workflow to meet the specific requirements
of the desired business function. business workflow uses the Business
Object Repository (BOR), which stores the definitions for each SAP
object in the application.
Advantages
- Provides synchronous event detection
- Makes use of SAP's object-oriented business object
capability to link the detection of events to ABAP function modules
- Is easy to implement
Disadvantages
- An SAP object does not exist in the SAP BOR for every business
process
- The SAP event (such as Created or Deleted) may not exist for
the SAP object
- It may not detect all changes in a business process
- It does not always provide the flexibility for detecting events
at the proper time
- It depends on SAP-provided functionality, which may change between
versions of SAP
Change pointer
Change pointer is a related feature
of business workflow that uses change documents to detect events.
Change documents are created for some business processes so that all
changes for that business process are captured.
Advantages
- Provides synchronous event detection
- Needs only one SAP modification for an adapter function module
to handle all business processes
- Generally available for the Logistics module
- Has access to SAP change pointer information for the event detection
process
- If change documents are already used for a business process,
it needs only a minimal amount of work to detect an event
Disadvantages
- It is somewhat flexible, but the event detection placement cannot
be changed since it is done by SAP
- It requires a solid understanding of change documents and the
business workflow environment
- You must do an SAP modification to turn on the change document
flag for an SAP data element
- Change pointer information in SAP may not be sufficient for
the event detection process
