Event Concepts
Use
Validity: Only in the Background Processing System
Events have meaning only in the background processing system. You can use events only to start background jobs.
Triggering an event notifies the background processing system that a named condition has been reached. The background processing system reacts by starting any jobs that were waiting for the event.
Event Types
There are two types of events:
-
System events are defined by SAP. These events are triggered automatically when such system changes as the activation of a new operation mode take place.
-
User events are events that you define yourself. You must trigger these events yourself from ABAP or from external programs. You could, for example, signal the arrival of external data to be read into the SAP system by using an external program to trigger a background processing event.
Event Arguments
You can qualify an event with an event argument. An event argument is a text string that you can optionally associate with an event. You can specify an event argument during the following operations:
-
when you schedule a job to wait for the event
-
when you trigger 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 when the event is triggered. The job can start if:
-
the event is triggered without any argument; or
-
the event is triggered with the argument that you specified for the job.
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.
|
Job |
Event |
Result |
|
Job scheduled with Event ID JSTART Argument A |
JSTART triggered, no argument |
Job starts |
|
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 makes it possible to react to an event depending upon the argument string that was supplied with it.
Example
Events and Event Arguments
Switching to a different operation mode triggers an 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 whenever an event occurs. In the previous example, your job would be run whenever operating mode NIGHT becomes active, not just the first time that the event occurs.