Parallel Processing In OOabap


 Step1. Create a report with class and methods.


REPORT  zparallel_processing_oo.

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 bapivbelnvbeln
sdoc2 TYPE bapivbelnvbeln ,
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 handle1.
DATAret1 TYPE TABLE OF bapisdstat.
RECEIVE RESULTS FROM FUNCTION ‘BAPI_SALESORDER_GETSTATUS’
TABLES
statusinfo        ret1.
ret11 ret1.
chk1 abap_true.

ENDMETHOD.                    “HANDLE1



METHOD handle2.
DATAret2 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.

  PARAMETERSp_sdoc1 TYPE bapivbelnvbeln,
p_sdoc2 TYPE bapivbelnvbeln.

CALL METHOD lcl_demo=>call
EXPORTING
sdoc1 p_sdoc1
sdoc2 p_sdoc2.

  LOOP AT ret11 INTO ret.
WRITE :/ retdoc_number retmaterialretcreation_date.
ENDLOOP.
CLEAR ret.
LOOP AT ret22 INTO ret.
WRITE :/ retdoc_number retmaterialretcreation_date.
ENDLOOP.


Step2. The screen shot of the report.

Step3. Provide the Input and execute it.

Step4. The O/p is shown below.


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s