Batch job event triggers can be used in a smart way to trigger a batch job when needed.
Defining the event in SM64
In transaction SM64 you can see the current events and also create a new custom event:
Triggering the event
The event can be triggered from SM64 by selecting the event and pressing the Execute button:
Or you can trigger from an ABAP program with the function module BP_RAISE_EVENT.
FORM RAISE_EVENT. CALL FUNCTION 'BP_EVENT_RAISE' EXPORTING EVENTID = 'ZMYEVENT' EVENTPARM = 'EVENTPARM 'Test' TARGET_INSTANCE = ' ' EXCEPTIONS BAD_EVENTID = 1. ENDFORM. " RAISE_EVENT
Or you can trigger from OS level with the sapevt program.
Schedule job with event trigger
Now we will schedule the job in SM36 using a test program ZHELLOEVENT. In the job definition we will run the program ZHELLOEVENT. In the scheduling we will use the start condition After Event:
When you trigger the event now in SM36 you see the job will execute nicely. Go to transaction SM37 and key in the Or after event search option:
You will now find the jobs after the event triggering.
Jobs waiting for a trigger
To find batch jobs that are still waiting for a trigger, use SE11 to see the content of table BTCEVTJOB.
Reorganization of batch jobs events
Settings are done in SM64:
Run background program RSEVTHISTREORG for the clean up.
OSS notes
Relevant OSS notes:
- 3054357 – SM65: Consistency check does not delete all BTCEVTJOB inconsistencies
- 3192159 – Event-driven jobs are not executed
- 3331861 – Event-periodic job is not rescheduled
- 3357671 – Error when raising remote event from SM64
- 3386236 – Triggering events in remote systems
- 3383742 – Event-Driven Jobs are not executed