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.

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

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.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !