Problem solve Get help with specific problems with your technologies, process and projects.

Running SAP Programs from UNIX

This tip will help you learn more about running SAP Programs from UNIX.

To do this we have to create an SAP User Event, An SAP User 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.

* Create an event in SM62. Create it under "User Event Names" and "Maintain". * Goto SM36 and create the job. In the Job fill in the ABAP/4 program and Variant (if required), For the "START DATE" select option AFTER EVENT. And enter SAP event name you created and save. * When the event is triggered this newly created job will execute. The event can be triggered at the Unix level using the Keyword "SAPEVT". For Example: We have to run the Program ZTEST_PROG from Unix and pass certain parameters to this program as well. Step 1 Create the SAP User Event "RUN_TEST_PROG" Step 2 Create Job "JOB_TEST" , Put the program name and variant name and in the start date, select the after event Option and put the Event name "RUN_TEST_PROG" in the there. Step 3 In the UNIX Script give the following command ${exe}/sapevt 'RUN_TEST_PROG' -p ${1},Y pf =${pf} Step 4: The program will be executed by the job using the variant specified in the job. Also to get the parameters which we have passed in UNIX we need to call the function module 'GET_JOB_RUNTIME_INFO' in program which will pass us the parameters and than we can use these as we require.
eventid    LIKE tbtcm-eventid,        
eventparm  LIKE tbtcm-eventparm.

       IMPORTING                               eventid    = eventid            
eventparm  = eventparm          
       EXCEPTIONS                              no_runtime_info = 1                  
OTHERS          = 2.   

Dig Deeper on SAP implementation

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.