SAP Event Processing
An SAP event is a “flag” that is created by using transaction SM62 View and Maintain Background Events. The commonest use of Events is to trigger jobs. Events can be triggered from the Operating System or from within SAP – either within ABAP programs and Function modules or from Transaction SM64.
Create an Event in transaction SM62. Select the Maintain radio button next to User Event Names and execute. This will present tyou with the Edit User Events screen. You can add change or delete user events from here.
To use this Event as a trigger, create a job via transaction SM36. You specify the Event that will trigger this job using the Start Condition button. On the Start Condition screen, select option AFTER EVENT. The After Event fields will open for input. Fill these in and Save.

You can see which jobs are waiting for events by looking at table BTCEVTJOB (via transaction SE16). This is the system’s way of keeping track of which jobs are in the queue waiting for an event to occur. The EVENTID column contains those Events that will submit a Job. You should see several System Events here.
Now, once the event is triggered this newly created job will execute. The event can be triggered via transaction SM64 or from the Operating System (see below).
To get the event triggered from the Operating System, log into the <sid>adm user id (at the Operating System level) level and go to directory /usr/sap/<sid>/SYS/exe/run. Note that in the Unix / Linux implementations, there is an alias ‘cdexe’ that will get you there as well. Run the SAPEVT executable as follows :
sapevt <event_name> -t pf=<instance_profile_directory_and_name> nr=<sys_number>
Example:
sapevt roberts_test -t pf=/usr/sap/DEV/SYS/profile/DEV_DVEBMGS00_server001 nr=00
This will raise the event, and cause the job scheduled within SAP to execute. Once the job has executed the SAP event that was in the table BTCEVTJOB will disappear.
Every time a Background Job is run, an entry is created in table TBTCO. This contains entries such as JOBNAME, EVENTID, EVENTPARM, JOBCLASS etc. This means that once you’ve found your job name in this table (using SE16) you can double click on its entry and see that it was executed via an event.


Leave a Reply