Skip to Content

Parallel Processing in ABAP

Lot of times we come across situations where we need to develop critical ABAP programs which does many complicated tasks and in turn causing performance bottle neck. To overcome the performance bottle necks we can divide ABAP programs into independent function modules, which can be, executed parallel thus increasing the performance throughput. Here I will demonstrate a simple scenario where the report takes two input parameters from the selection criteria and prints the sum and multiplication results on the screen. Sum and Multiplication are executed independently of each other and the main program waits until both the results are calculated and then prints the results on the screen. Simple scenario is taken for ease of demonstration for any ABAPer.

Parallel Processing

Source Code Extract-Main Program

&—-


*& Report  Z_PARALLEL_PROCESSING_DEMO

*&

&—-


*&

*&

&—-


REPORT  Z_PARALLEL_PROCESSING_DEMO.

DATA COUNT TYPE I.

DATA SUM TYPE I.

DATA MULTIPLY TYPE I.

PARAMETERS: FIRST TYPE I.

PARAMETERS: SECOND TYPE I.

COUNT = 0.

CALL FUNCTION ‘Z_SUM’

  STARTING   NEW  TASK   ‘SUM’

  DESTINATION   IN   GROUP   DEFAULT

  PERFORMING GET_SUM  ON   END   OF   TASK

  EXPORTING

    I_FIRST  = FIRST

    I_SECOND = SECOND.

CALL FUNCTION ‘Z_MULTIPLY’

  STARTING   NEW  TASK   ‘MULTIPLY’

  DESTINATION   IN   GROUP   DEFAULT

  PERFORMING GET_MULTIPLY  ON   END   OF   TASK

  EXPORTING

    I_FIRST  = FIRST

    I_SECOND = SECOND.

WAIT UNTIL COUNT = 2.

WRITE:/ ‘SUM = ‘,SUM.

WRITE:/ ‘MULTIPLY = ‘,MULTIPLY.

&—-


*&      Form  GET_SUM

&—-


  •       text

—-


  •      –>NAME       text

—-


FORM GET_SUM USING NAME.

  RECEIVE RESULTS FROM FUNCTION ‘Z_SUM’

     IMPORTING

       SUM = SUM.

  COUNT = COUNT + 1.

ENDFORM.                    “GET_SUM

&—-


*&      Form  GET_SUM

&—-


  •       text

—-


  •      –>NAME       text

—-


FORM GET_MULTIPLY USING NAME.

  RECEIVE RESULTS FROM FUNCTION ‘Z_MULTIPLY’

     IMPORTING

       MULTIPLY = MULTIPLY.

  COUNT = COUNT + 1.

Caluclate Sum-Function Module

!https://weblogs.sdn.sap.com/weblogs/images/37515/w_2.gif|height=286|alt=Sum|width=334|src=https://weblogs.sdn.sap.com/weblogs/images/37515/w_2.gif|border=0!

Caluclate Multiplication-Function Module

Multiply

Blog demonstrates the parallel processing using very simple scenario and this can be extended to complicated scenarios and process allocation to different application servers can also be done using standard function modules.

Please refer to SAP HELP for further information.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

    1. Subramanian Venkateswaran
      Hi,

      Yep, one of those deja vu things. However, it is good to have weblogs on same topic, gives different perspective and different approach to same problem/concept.

      Coming to the weblog, I have never come across many practical usage of parallel processing in my limited experience in ABAP. One of the reasons being it is required where heavy computation takes place and am not sure that happens , if at all, in R/3 .

      The one place, where I(thought) required parallel processing was in fetching data from R/3 quickly and that required optimizing of select query.
      Unfortunately, that was a select query whose results depended upon previous select query results.

      If someone could write a good blog on the usage/s of Parallel Processing in SAP R/3, that would be much appreciated.

      Best Regards,
      Subramanian V.

      (0) 
      1. Scott Barden
        I could write a blog, focused on parallel processing of large database processing, but it relies upon a 3rd party product (that I have an alignment with) so I’m not sure whether such a blog is appropriate for SDN.

        Scott

        (0) 
        1. Naresh Pai Post author
          I agree to the point that this blog does not throw much light on the real-time scenario. Lot of times I have come across in R/3 where we need to fetch data independently from lot of tables and then print on the screen.Those tables are pretty huge and lot of other code cannot be executed because it is a single threaded program.I would surely come up with a real-time scenario for parallel processing using ABAP OO!It would be interesting to break the programs into independent objects and execute the objects in parallel.
          (0) 
      2. Brad Williams
        Hi Subramanian.

        At my last client we needed to implement parrallel processing (although in this case, using background jobs) to generate a customer price list (requested via an integrated customer self service web site) and email it to the customer.  This involved determining the customer specific price (based on a combination of many different price conditions) for up to 10,000 materials.  We set ourselves a limit of 15 minutes to generate the list and email it to the customer.  At around 1 second a material using standard functionality, parrallel processing was a good option to meet this target.

        Cheers,

        Brad

        (0) 
  1. Rajesh Mishra
    Obviously by using the parallel processing techniques, one can significantly improve the runtime of the total planning run.
    For this purpose, either select various sessions on one server or can also use several servers.

    The parallel processing procedure runs according to packages using the logic of the low-level codes.

    (0) 

Leave a Reply