Find Solution to your Query

Sunday, June 7, 2009

. How to Raise an Event from Unix / How to trigger an Event in SAP

An SAP event is a "flag" that is created in SAP (SM62). This event (or flag) can be triggered (from a Unix job to an incoming file), causing a job to execute in the background. This event (or flag) can be triggered within R/3 or can be done at the Unix level.

* First, create an event in SM62. It’s easy - just create it under "user event names" and "maintain". You’ll find the create option from there.

* Once created go to SM36 and create the job. Put in the job name you want to call it - fill in the ABAP/4 program you’ll want executed, but under "START DATE" select option AFTER EVENT. Then plug in your SAP event name you created. Fill in the remaining information on this screen and save.

* Once saved, an entry is put in table BTCEVTJOB. The entry is the name of the event you raised. This is the system’s way of keeping track of which jobs are in the queue waiting for an event to occur.

* Now, once the event is triggered this newly created job will execute. The event can be triggered via sap (SM64) or at the Unix level.


SM64 is pretty self-explanatory. To get the event triggered from Unix:

* Log into the adm user id at the Unix level and go to directory /usr/sap/SYS/exe/run (there is an alias called 'cdexe' that will get you there)

* From there look for an executable called sapevt. Open another Unix window cause now you are going to need to cut and paste.

* At the other sap window switch user to the adm user and go to the /usr/sap/SYS/profile directory ('cdpro' is the alias)

* Do an "ll | more" and look for the instance profile name (the sapevt executable will want this!) Example: _DVEBMGS00_

* Go back to the sapevt window and enter this command to get the event to raise:
sapevt -t pf= nr=

* Example: sapevt roberts_test -t pf=/usr/sap/SYS/profile/
_DVEBMGS00_ 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.

*Another table, TABTCO, will now have an entry in it with the SAP job that was executed. Once you’ve found that job name in this table you can double click on its entry and see that it was executed via an event.

# Please spare some time to put a comment, if this post was relevant for you or not. It helps me post better content.

2 comments:

Anonymous said...

ur efforts are appreciated

Nitin Nayyar said...

thanks,

Post a Comment

 

Enter your email address:

Delivered by FeedBurner