How to schedule a Background Job by triggering an Event

H

In this blog post let us take a look on how we can schedule a Background Job using Event as trigger.

First let us maintain an Event in SAP using transaction “SM62” which will be used as trigger to schedule the Job.

Open transaction “SM62” and create an Event with some name by pressing “Create” button under “BckPrcEvnts” tab and save the Event.

Now we have created an Event with name “Z_TRIGGER_BGJOB” which can be triggered using the standard Function Module “BP_EVENT_RAISE”. You can create an ABAP program to trigger the Event. To demonstrate this example, I have created a sample custom program “ZTRIGGER” which uses the Function Module “BP_EVENT_RAISE” to trigger the Event “Z_TRIGGER_BGJOB”.

Now we have an Event and a program which can trigger the Now let us create a Background Job and schedule its execution using Job Control Parameters.

We can create a Background Job using the transaction “SM36”, give a Job name and class and click on “Enter” where a popup window appears asking for the program and variant for which the job should be scheduled.

Now save it and come back, you must be seeing a message saying “1 Step(s) successfully defined”, Now we need to mention the “Start Condition” for the job that we have just defined where we will be using the Event we have created as a trigger to schedule this job.

Once you click on “Start Condition” following popup window appears, Just hit on the “After Event” button which will input enable the Event and Parameter Input options. Give Event details in Event Input Parameter and press “Save”.

That is all, Now let us test whether the Background Job is scheduled after triggering the Event and again finally press the “Save” button again to save. Execute the program “ZTRIGGER” and check whether the Job has been scheduled or not in “SM37” transaction.

About the author

Add comment

By Pavan

Recent Posts

Recent Comments

Archives