Application Development and Automation Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Enesyavuz
Explorer
1,282

Hi everyone,

In this blog, I will explain the use of background jobs in Parallel Processing.

First, let's answer the question, "What is a Background Job and Why Should We Use It?"

When performing parallel processing in SAP systems, dialog processes often hit the runtime timeout limit. In other words, when a process exceeds its time limit, the system terminates it. This can be a significant challenge for tasks that require longer execution times. However, using Background Jobs allows these processes to run in the background. Background jobs have much higher time limits, which means longer processes can be completed without any interruptions. This not only boosts the system's overall performance but also elevates the user experience by ensuring an uninterrupted workflow.

Scenario Overview

Let's query the 200,000 rows of sales order data using the BAPI_SALESORDER_GETSTATUS  for each order, both by using a loop and background jobs, and compare the execution times of both methods.

Retrieving Data from VBAK Table

The first step is to fetch sales order data from the VBAK table. We  limit the number of records to 200,000 and store them in internal table.

Enesyavuz_0-1738243391213.png

Running BAPI in LOOP

Enesyavuz_1-1738243426497.png

Running BAPI in a Background Job

The EXECUTE_BACKGROUND_JOB method splits the retrieved data into chunks of 10,000 records each and submits them to the SUBMIT_SALES_ORDER_JOB method, which starts background jobs for processing.

Enesyavuz_0-1738246418500.png

 

When the user triggers the program , The SUBMIT_SALES_ORDER_JOB method creates background jobs in the SAP system for processing the split sales order data.

Enesyavuz_3-1738243483347.png

 

When executed via a program job, the GET_SALES_STATUS method is triggered, allowing the system to retrieve the status of a sales order.

Enesyavuz_4-1738243483349.png

 

Running a Program with a LOOP

Enesyavuz_5-1738243538171.png

Enesyavuz_6-1738243538174.png

 

Running a Program with a Background Job

Enesyavuz_7-1738243538175.png

Enesyavuz_8-1738243538185.png

Enesyavuz_9-1738243538197.png

 

Results

When processing large data sets, using parallel processing with background jobs improves system performance and ensures business continuity. Unlike a single process that might fail and cause a dump, background jobs run independently, ensuring that critical operations are completed successfully.

You can visit my GitHub repository at https://github.com/EnesFYavuz/Background_Job to review the complete code.

 

2 Comments
Labels in this area