Login Form

Best viewed in IE 7.0

ADVERTISEMENTS
ADVERTISEMENT

Triggering a job from outside SAP using Job Events

STEP 1.    Define User Event

o   Transaction SM62

o   Maintain User event name

STEP 2.    Create the event

o   Click the Create Icon or press F5

o   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

o   Save

STEP 3.    Define background job

o   Transaction SM36

o   As per normal give the job a name and the required steps to perform

o   Click on the “Start Condition” button

o   Click the “After event” button

o   Enter the event name created in the previous step or search via the dropdown

o   Click on “Periodic Job” so that this job will be called each time the event is raised

o   Save

o   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

o   Call transaction SM64

o   Enter your event name

o   Click the button “Trigger”

o   Success Message “Event ZLAUNCH_JOB_XXX successfully triggered” is raised

o   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

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

§  Open RFC session

·         -> Open XMI session for XBP

o   -> Call XBP functions

·         -> Close XMI session

§  -> Close RFC session

o   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:

o   EXTCOMPANY         INSIGHT

o   EXTPRODUCT         XPM

o   INTERFACE              XBP

o   VERSION                   1.0

o   Call XBP function: BAPI: BAPI_XBP_EVENT_RAISE

·         Parameters:

o   EVENTID                   ZLAUNCH_JOB_XXX

o   EXTERNAL_USER_NAME            WF-BATCH

o   Close XMI Session

§  Call function SXMI_LOGOFF to end the session

·         Parameters:

o   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