Login Form

Best viewed in IE 7.0

ADVERTISEMENTS
ADVERTISEMENT

Triggering a job from outside SAP

STEP 1. Define User Event 

  • Transaction SM62
  • Maintain User event name

STEP 2. Create the event

 

  • Click the Create Icon or press F5
  • Enter your event name and description
The name need not start with Z but if you do start it with Z it will be easily distinguishable from standard SAP events when you are defining your job
        • Save

STEP 3. Define background job

  • Transaction SM36
  • As per normal give the job a name and the required steps to perform
  • Click on the “Start Condition” button
  • Click the “After event” button
  • Enter the event name created in the previous step or search via the dropdown
  • Click on “Periodic Job” so that this job will be called each time the event is raised
  • Save
  • Save the job in order to put it in “Released” Status
  • NOTE: To view the job details go to transaction SM37 and select the following:
  • Job status: Released
  • Click the “Extended Job Selection” button
  • Enter your event in the field “OR start at event”
  • Execute

STEP 4. Test the event in SAP

  • Call transaction SM64
  • Enter your event name
  • Click the button “Trigger”
  • Success Message “Event ZLAUNCH_JOB_XXX successfully triggered” is raised

NOTE: Using SM37 to monitor your jobs you can view the successful job launch by searching for “Finished” jobs

 

STEP 5. Calling the Event externally using a BAPI

 

  • To call the event we need to follow the following steps:

Open RFC session
• > Open XMI session for XBP

> Call XBP functions

• > Close XMI session
Close RFC session

Open XMI Session: Log on to the CCMS XMI interface (SXMI_LOGON) (see SDN Document for Detail)
User must have XMI authorization (R/3 authorization object S_XMI_PROD). The following roles have this authorization:
• S_A.SYSTEM
• PD_CHICAGO
• S_WF_RWTEST
• SAP_ALL
Call function SXMI_LOGON to start the session
• Parameters:

EXTCOMPANY CO
EXTPRODUCT XPM
INTERFACE XBP
VERSION 1.0

Call XBP function: BAPI: BAPI_XBP_EVENT_RAISE
• Parameters:

EVENTID ZLAUNCH_JOB_XXX
EXTERNAL_USER_NAME WF-BATCH
Close XMI Session

Call function SXMI_LOGOFF to end the session
• Parameters:

INTERFACE XBP

NOTE: You can also call an executable to raise the event as follows:

 

  • SAPEVT.EXE is part of the R/3 kernel. It is located under the /usr/sap/sys/exe/run directory on the central instance
  • Syntax: sapevt <Event Name> pf=<Default Profile with path>. E.G. sapevt ZLAUNCH_JOB_XXX pf=/sapdev/sapmnt/DEV/sys/profile/default.pfl. You need to have read access to this file
  • SAPEVT.EXE can be copied off the SAP server and run anywhere, even from your desktop
  • You need an entry in your services file with the TCP port for the SAP messenger. Find the services file in c:\windows\system32\drivers\etc. Add the entry at the bottom: sapmsDEV 3600/tcp
ADVERTISEMENT
Free software downloads