How to create a Background job

In this post, we will discuss about Background jobs.

In most of the organizations, there might be huge reports which run for an undefined or take more time if executed in foreground. We can’t predict how much time the report might take to get executed because data in real time will be very huge like in numbers of millions. This undefined time might lead to time out error(dump) in sap. To avoid this unnecessary time out errors, we schedule the background jobs for those reports. Background jobs are also scheduled to avoid the user interaction because sometimes the program need to be run in timely or periodic manner like hourly, daily, weekly etc.

There are two ways in which we can schedule a report as background job.

Method 1: Using T-code SM36

Go to t-code SM36 -> Enter new Job name -> click on Step icon

Image_37

Once clicked on Step icon, it will prompt you to fill Abap program name and variant

Image_38

I have entered my program name and variant.

Now click on save icon to save the background job.

Note: Variant is mandatory if the program has input fields in the selection screen

Image_39

Click on back button

Image_40

Once job is created we need to set condition for job when it need to be executed. For that, click on the ‘Start condition’ icon

Image_41

A pop up will be raised with some options.

Now we need to select the appropriate option as per the requirement.

Immediate – Job will be executed immediately right after releasing

Date/time  – Job will be executed in between the specified interval

After job    – Job will be executed after the completion of another job.

Once selected the required approach, click on save.

Click on save again

Image_42

Job will be released and it is ready for execution as per the scheduled date or time.

To view the status of the job, click on Job Selection icon or enter T-code SM37

Image_43

Enter the selection criteria which jobs you want to view.

Image_44

Execute or F8

Image_45

Here we can see the status of the job.

We can also see the job log (Shows the process steps of job) and the result of the job by clicking on spool icons in the toolbar.

Method 2: Using T-code SE38

Enter T-code SE38 -> Enter the program name -> click on menu ‘Program’ -> Execute -> Background

Image_46

Enter the variant name

Image_47

Now click on ‘Execute immed.’ button if you want your background job to be executed immediately else click on schedule to execute on certain time.

Image_48

Enter Job name and select options if you want to schedule periodically or only once as per your requirement.

Also, click on Job overview to see the status of the job.

Leave a Reply