Parallel processing is implemented in ABAP reports and programs, not in the background processing system itself. That means that jobs are only processed in parallel if the report that runs in a job step is programmed for parallel processing. Such reports can also process in parallel if they are started interactively.
Parallel processing in OAbap is using class and methods in report level program.
Parallel Processing is implemented with a special variant of Asynchronous RFC. It’s important that you use only the correct variant for you own parallel processing applications. The “CALL FUNCTION STARTING NEW TASK DESTINATION IN GROUP” keywords.
when a huge number of records needs to be processed and it takes a lot of time to produce the output, this parallel processing technique can be applied to achieve run time improvement. So, this Parallel processing is an asynchronous call to the Function Module in parallel sessions/ different session/ multiple sessions.
T-Codes:
RZ12 – To Check the Server Group.
SM66 – To Check all the Work Processers.
SM51 – To Check the Application Server.
SM21 – System log in case of any failures.
“”””” parallel processing “”””””””
REPORT ZPARALLEL_PROCESSING_OABAP.
DATA:chk1,
chk2,
ret11 TYPE TABLE Of bapisdstat,
ret22 TYPE TABLE OF bapisdstat,
ret TYPE bapisdstat.
CLASS lcl_demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
CALL IMPORTING sdoc1 TYPE bapivbeln–vbeln
sdoc2 TYPE bapivbeln–vbeln,
handle1 IMPORTING p_task TYPE clike, “must have a importing para-of type clike
handle2 IMPORTING p_task TYPE clike. “must have a importing para-of type clike
ENDCLASS. “LCL_DEMO DEFINITION
*———————————————————————-*
* CLASS LCL_DEMO IMPLEMENTATION
*———————————————————————-*
CLASS lcl_demo IMPLEMENTATION.
METHOD call.
CALL FUNCTION‘BAPI_SALESORDER_GETSTATUS’
STARTING NEW TASK‘FUNC1’
DESTINATION‘NONE’
CALLING handle1 ON END OF TASK
EXPORTING
salesdocument = sdoc1.
CALL FUNCTION ‘BAPI_SALESORDER_GETSTATUS’
STARTING NEW TASK ‘FUNC2’
DESTINATION ‘NONE’
CALLING handle2 ON END OF TASK
EXPORTING
salesdocument = sdoc2.
WAIT UNTIL chk1 = abap_true AND chk2 = abap_true.
WRITE:/‘SUCCESS’.
ENDMETHOD. “call method
METHOD handle1.
DATA: ret1 TYPE TABLE OF bapisdstat.
RECEIVE RESULTS FROM FUNCTION ‘BAPI_SALESORDER_GETSTATUS’
TABLES
statusinfo = ret1.
ret11 = ret1.
chk1 = abap_true.
ENDMETHOD. “HANDLE1
METHOD handle2.
DATA: ret2 TYPE TABLE OF bapisdstat.
RECEIVE RESULTS FROM FUNCTION ‘BAPI_SALESORDER_GETSTATUS’
TABLES
statusinfo = ret2.
ret22 = ret2.
chk1 = abap_true.
ENDMETHOD. “HANDLE2
ENDCLASS. “LCL_DEMO IMPLEMENTATION
START-OF-SELECTION.
PARAMETERS: p_sdoc1 TYPE bapivbeln–vbeln,
p_sdoc2 TYPE bapivbeln–vbeln.
CALL METHOD lcl_demo=>call
EXPORTING
sdoc1 = p_sdoc1
sdoc2 = p_sdoc2.
LOOP AT ret11 INTO ret.
write: / ret–doc_number , ret–material, ret–creation_date.
ENDLOOP.
CLEAR ret.
LOOP AT ret22 INTO ret.
write:/ ret–doc_number,ret–material, ret–creation_date.
ENDLOOP.
PROGRAM:
Image 1
Defining a Class : When you define a class, you define a blueprint for a data type. This doesn’t actually define any data, but it does define what the class name means, what an object of the class will consist of, and what operations can be performed on such an object.
That is, it defines the abstract characteristics of an object, such as attributes, fields, and properties.
Implementation : Implementation of a class contains the implementation of all its methods. In ABAP Objects, the structure of a class contains components such as attributes, methods, events, types, and constants.
Image 2
-
ABAP keyword CALL FUNCTION <function> STARTING NEW TASK <taskname> with the DESTINATION IN GROUP argument.
-
Use this keyword to have the SAP system execute the function module call in parallel. Typically, you’ll place this keyword in a loop in which you divide up the data that is to be processed into work packets. You can pass the data that is to be processed in the form of an internal table (EXPORT, TABLE arguments). The keyword implements parallel processing by dispatching asynchronous RFC calls to the servers that are available in the RFC server group specified for the processing.
Waiting for job completion: As Line No 37 : indicates wait until with abap boolean .
As part of your task management, your job must wait until all of the parallel processing tasks have been completed.
To do this, the program uses the WAIT UNTIL keyword to wait until the number of completed parallel processing tasks is equal to the number of tasks that were created.
Image 3
Methods : The definition of a method is declared in the class declaration and implemented in the implementation part of a class.
The METHOD and ENDMETHOD statements are used to define the implementation part of a method.
ABAP keyword RECEIVE: Required if you wish to receive the results of the processing of an asynchronous RFC.
RECEIVE retrieves IMPORT and TABLE parameters as well as messages and return codes.
Image 4
Image 4 : as its business implemented , declaring the parameter .CALL the method with respective parameter
Use LOOP and ENDLOOP executes the statement block between LOOP and ENDLOOP once for each read row. The output response result determines how and to where the row contents are read. The table key with which the loop is executed can be determined in cond.
OUTPUT:
Parallel processing is a method in computing of running two or more processors (CPUs) to handle separate parts of an overall task. Breaking up different parts of a task among multiple processors will help reduce the amount of time to run a program using class and methods, which helps in performance.
Time consumption in OAbap is less compared to normal Abap reports.
I hope Abapers will understand Parallel Processing with Classes and Methods.
Please provide your feedback and your thoughts into comment section below.
Do you have any Q&A please reach to https://answers.sap.com/index.html and post your
questions.
follow the ABAP Development environment Topic page https://community.sap.com/topics/abap
and for reading further blog post visit https://blogs.sap.com