Triggering Events from External Programs
Use the SAP program SAPEVT to trigger an event from a program running outside the SAP system.
The syntax for SAPEVT is as follows:
sapevt <EVENTID> [-p <EVENTPARM>] [-t] pf=<Profile Name>|name=<SAP system name> nr=<SAP system mumber>
The SAPEVT parameters are as follows:
<EVENTID> : The name of the event as defined in the SAP system with transaction SM64.
-p <EVENTPARM> : An optional argument for the EVENTID which qualifies the event. The EVENTPARM is not defined in the SAP system.
-t : Causes SAPEVT to log its actions in a short trace file. You can find the trace file in the current directory of the user who called SAPEVT.
pf=<Profile Name> or name=<SAP system name> nr=<SAP system mumber> : Either pf or name and nr identify the SAP system in which the event is to be triggered.
At least one instance of the SAP system must be active when SAPEVT runs. Otherwise, the system will not know that the event has occurred. The instance must have the number specified in the SAPEVT call.
In more detail, the parameters for identifying the SAP system are as follows:
pf <Profile Name> : Enter the name of the profile with which the SAP background processing instance(s) are started. SAPEVT identifies the SAP system from the specifications in the profile.
You can find SAP system profiles in the globally shared SAP directory SYS\profile (Windows NT), or SYS/profile (UNIX).
name=<SAP system name> nr=<SAP system number> : The name of the SAP system (SID) and the SAP system number.
Requirements for Using SAPEVT
To use SAPEVT to trigger an event, the following requirements must be met:
An SAP instance that offers background processing must be running or the start of jobs waiting on the event will be delayed.
If no instance in an SAP system is active when an external program triggers an event, than the event is ignored, the SAP system will not know that the event has occurred.
If a job that was scheduled to run when an event occurs cannot be started immediately, it is rescheduled as an immediate-start job. It will then be run at the earliest possible opportunity.
If SAPEVT is started with a profile name as an argument, then the program must have access to the shared profile directory of the SAP system. SAPEVT needs to read the profile of the system to which it is sending the event.
If access to the directory is not possible, then you can create a local profile for SAPEVT. This profile need only contain values for the parameters rdisp/mshost and rdisp/msserv . Take the values from the profiles of the target SAP system. Specify the local profile in the SAPEVT command line.
Network connection: SAPEVT must be able to establish a TCP connection to the SAP instance.
SAPEVT reports problems in establishing a connection to the SAP system in its log file.
User search path: The SAP executables and profile directories must lie in the search path of the user who starts the program that calls SAPEVT.
UNIX: /usr/sap/<SAP system ID>/SYS/exe/run and SYS/profile
Windows NT: \\<Host Name>\sapmnt\<SAP system ID>\SYS\exe\run and SYS\profile