In addition to time- and calendar-based job scheduling, the background processing system supports event-driven scheduling. The image below illustrates how background processing events can be used and processed.
Use
Events have meaning only in the background processing system and can be used only to start background jobs.
Triggering an event notifies the background processing system that a particular condition has been met. The background processing system reacts by starting any jobs that were waiting for that event.
Events are not saved. Once an event occurs and triggers any jobs that were waiting for that event, the event is discarded.
Integration
Event Types
There are two types of events:
- System events: Defined by SAP and triggered automatically by system changes, such as the activation of a new operation mode. You cannot modify system events.
- User events: Defined by users. These events must be triggered from ABAP or from external programs. For example, use an external program to trigger a background processing user event to signal the arrival of external data to be read into the SAP System.
Event Arguments
An event argument is an optional text string you can use to qualify an event. You can specify an event argument when:
- Scheduling a job to wait for the event
- Triggering an event
Unlike event IDs, event arguments are not defined in the SAP System.
If you specify an argument when you schedule a job, then the job is eligible to start only when the event is triggered with the argument.
If you don’t specify an argument when you schedule a job, then the job can start as soon as the event occurs. The job is eligible to start no matter what argument string is supplied with the event.
When a Job Waiting for an Event May Start
Job | Event | Result |
Job scheduled with Event ID "JSTART" Argument "A" | JSTART triggered, no argument | Job does not start, continues to wait for JSTART A |
JSTART triggered with argument "A" | Job starts | |
JSTART triggered with argument "B" | Job does not start; continues to wait for JSTART. | |
Job scheduled with Event ID "JSTART", no argument | JSTART triggered, no argument | Job starts |
JSTART triggered with any argument | Job starts |
An ABAP program that is running as a background job can find out what event and argument were presented when it was started. This allows ABAP programs running in the background to react intelligently to an event depending on the argument string that was supplied with it.
An Example of Events and Event Arguments
Switching to a different operation mode triggers a system event in the background processing system. The event is an SAP System event named SAP_OPMODE_SWITCH. As an argument, the event carries the name of the new operating mode.
If you schedule a job to wait on the event SAP_OPMODE_SWITCH with argument NIGHT, then your job is eligible to start when the operating mode NIGHT becomes active the next time.
You can also schedule jobs to be repeated each time event occurs. In the previous example, your job could be run each time the operating mode NIGHT becomes active, not just the first time the event occurs.
The Operation mode button allows you to schedule a job to wait for a particular operation mode to become active.
No comments:
Post a Comment