Triggering SAP 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>

Example: sapevt END_OF_FI_DATATRANS name=C11 nr=11 triggers the event END_OF_FI_DATATRANS without a parameter. The event is triggered in SAP system C11, instance number 11. Any jobs that are waiting for this event are started.

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.

SAP Job Injector

You will find in this article two ABAP tools for injecting jobs in SAP from Excel files.

Simple injector

Download program ZTREXPI100

Input file : Tab delimited text

 Zone Length Description
 JOB  32  Job name
 USER  12  Execution User
 TYPE  1  P(Program) or S(Script)
 PROG  100  Program or Script
 PARAM  100  Variant or parameter

A set of controls is performed by the program before creating jobs in status “Scheduled“.

Program ZTREXPI100
injecteurs_jobs-1


Mass job creation and planification

ZTREXPI200

This program is more advanced than the first since it allows to inject and release the jobs according to scheduling criteria specified in a text file.

– File containing job definition :

 Zone Length Description
 JOB  32  Job name
 USER  12  Execution User
 TYPE  1  P(Programme) or S(Script)
 PROG  100  Program or Script name
 PARAM  100  Variant ou parameter

– File containing scheduling criteria :

 Zone Length Description
 JOB  32  Job name
 TARGETSYSTEM  40  Target server (cf SM51)
 TYPE  2  Planification type : DH (Date/Hour) ou EV (on event)
 SDLSTRTDT  8  Execution date (AAAAMMJJ)
 SDLSTRTTM  6  Execution time (HHMNSS)
 PRDMONTHS  2  Period in months
 PRDWEEKS  2  Period in weeks
 PRDDAYS  3  Period in days
 PRDHOURS  2  Period in hours
 PRDMINS  2  Period in minutes
 CALENDAR_ID  2  Factory calendar
 BTC_PROCESS_ALWAYS  1  Run sundays and during holidays (blank or X)
 BTC_DONT_PROCESS_ON_HOLIDAY  1  Do not run sundays and jours fériés (blanc ou X)
 BTC_PROCESS_BEFORE_HOLIDAY  1  Schedule to the previous working day(blank ou X)
 BTC_PROCESS_AFTER_HOLIDAY  1  Schedule to the next working day
 EVENT_ID  32  Event
 EVENT_PARAM  64  Event parameter
 EVENT_PERIODIC 1  Event periodic

Excel files for data formatting are available Here

Program ZTREXPI200
injecteurs_jobs-2

Optimizing the number of SAP work processes

This is a simple method to determine the optimal number of work processes DIA, BTC, UPD, …

– Execute transaction SM50
– Display CPU time via CTRL+SHIFT+F6 or menu List -> CPU

For each process type (DIA, BTC, …), you must have at least one process with a very small CPU time which mean that this work process was never used since SAP startup.
wp_sm50