Parallel Processing with Background Jobs in SAP

Estimated read time 4 min read

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.

Running BAPI in LOOP

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.

 

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.

 

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

 

Running a Program with a LOOP

 

Running a Program with a Background Job

 

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.

 

 

​ 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 OverviewLet’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 TableThe 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.Running BAPI in LOOPRunning BAPI in a Background JobThe 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. 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. When executed via a program job, the GET_SALES_STATUS method is triggered, allowing the system to retrieve the status of a sales order. Running a Program with a LOOP Running a Program with a Background Job ResultsWhen 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.    Read More Application Development Blog Posts articles 

#SAP

You May Also Like

More From Author