SPTA Framework – Parallel Processing Technique in SAP ABAP

Now a day for some SAP program, the nights are getting too short to execute.
The CP industry, specially for distribution client the data volume is increasing very high day by day.

With the huge volume of data we are facing problems:
          Scheduled jobs are not finishing within the time frame.
          Dump for ABAP memory issue for huge data processing.
          Dump for timeout error for huge data processing.

SAP offers a solution for the problem: called parallel processing.
There are different frameworks available for parallel processing;
SPTA is the most popular one.

Let’s begin with one example of parallel processing with SPTA framework.

 We can predefined three parameters for SPTA framework.
  1. Server Group – Instances (maintained in RZ12).
  2. Maximum number of work packet per server instance.
  3. Maximum number of records per work packet.
Let’s assume one record takes 1 sec for processing.

Before implementing SPTA –
1000 records get processed one by one and it will take 1000 sec (16 min approx) to be processed.

After implementing SPTA –
All the 1000 records get processed into 10 different tasks and that runs parallel, so by this way it takes 100 records processing time to complete 1000 records process and that is 100 sec (2 min approx).

So the total performance improvement would be 800% which can turn around whole day running job into few minutes.

SPTA Framework in Details:

There are three parameters by which we will call three subroutines to build our own logic for parallel processing.

  • BEFORE_RFC_CALLBACK_FORM: This routine is called by the function module before calling the RFC function module. Here we have to build different work packets which we want to process in the RFC function module.
  • IN_RFC_CALLBACK_FORM: This routine is called by the function module after work packets are created. In this routine we can use our own RFC enabled function module or custom code to process each work packets.
  • AFTER_RFC_CALLBACK_FORM: This routine is called at the end by the function module. After processing of all the work packets we have to collect all the processed data.

Other mandatory parameters are
·         SERVER_GROUP (we can pass our server group name which has been created from RZ12).
·         CALLBACK_PROG (The calling program name).
·         USER_PARAM (Data to be processed in SPTA process).


The main step in BEFORE_RFC_CALLBACK_FORM is WP (work packet) creation.
Here we are creating WP with maximum 10 records inside.

After finishing all the WP creation, all the WP will run in different tasks in parallel mode in IN_RFC_CALLBACK_FORM.




Debugging SPTA using SRDEBUG:

It’s good to remember that sometime when different server instances being used in SPTA processing then only the external breakpoint would not work to go into debug mode. In this case we need to use SRDEBUG.


Parallel tasks (sessions) in SPTA:

Here I have tried to make a clear picture of all the WP creation and how all the WP run in different sessions or tasks.

I have putted a breakpoint in the IN_RFC subroutine and run the main program, all the WP being created in BEFORE_RFC and then all the task will run in parallel mode in IN_RFC.


SAP has provided a sample demo program to understand SPTA Framework easily.
Program name –
SPTA_PARA_DEMO_1    Simple parallelization (without individual task dependence)

Leave a Reply

Your email address will not be published. Required fields are marked *