Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Parallel processing: Help!

Former Member
0 Likes
767

Hi Experts!

I need to use parallel processing for BAPI_INQUIRY_CREATEFROMDATA2 since this process huge data.

How could I actually start a parallel processing using this BAPI ?

Thanks!

1 ACCEPTED SOLUTION
Read only

alejandro_lpez
Contributor
0 Likes
587

Hi Diane,

To call BAPI_INQUIRY_CREATEFROMDATA2 in parallel processing, you can use the statement <b>IN BACKGROUND TASK</b>::

CALL FUNCTION func IN BACKGROUND TASK

[DESTINATION dest]

parameter_list

[AS SEPARATE UNIT].

regards,

Alejandro.

4 REPLIES 4
Read only

alejandro_lpez
Contributor
0 Likes
588

Hi Diane,

To call BAPI_INQUIRY_CREATEFROMDATA2 in parallel processing, you can use the statement <b>IN BACKGROUND TASK</b>::

CALL FUNCTION func IN BACKGROUND TASK

[DESTINATION dest]

parameter_list

[AS SEPARATE UNIT].

regards,

Alejandro.

Read only

Former Member
0 Likes
587

Hi,

Check this example..This code is there in the abap help..

Press F1 on the CALL FUNCTION key word..

Then choose the link..

"CALL FUNCTION func STARTING NEW TASK taskname. "

There you will find the code that I mentioned here...

DATA: MSG_TEXT(80) TYPE C. "Message text

...

  • Asynchronous call to Transaction SM59 -->

  • Create a new session

CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'TEST'

DESTINATION 'NONE'

EXPORTING

TCODE = 'SM59'

EXCEPTIONS

COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT

SYSTEM_FAILURE = 2 MESSAGE MSG_TEXT.

IF SY-SUBRC NE 0.

WRITE: MSG_TEXT.

ELSE.

WRITE: 'O.K.'.

ENDIF.

Using RFC groups to parallelize function module calls (RFC parallel processing)

TYPES: BEGIN OF TASKLIST_TYPE,

TASKNAME(4) TYPE C, "Task administration

RFCDEST LIKE RFCSI-RFCDEST

END OF TASKLIST_TYPE.

DATA: INFO LIKE RFCSI, C, "Message text

JOBS TYPE I VALUE 10, "Number of parallel jobs

SND_JOBS TYPE I VALUE 1, "Sent jobs

RCV_JOBS TYPE I VALUE 1, "Received replies

EXCP_FLAG(1) TYPE C, "Number of RESOURCE_FAILUREs

TASKNAME(4) TYPE N VALUE '0001', "Task name administration

TASKLIST TYPE TABLE OF TASKLIST_TYPE,

WA_TASKLIST TYPE TASKLIST_TYPE.

...

DO.

...

CALL FUNCTION 'RFC_SYSTEM_INFO'

STARTING NEW TASK TASKNAME DESTINATION IN GROUP DEFAULT

PERFORMING RETURN_INFO ON END OF TASK

EXCEPTIONS

COMMUNICATION_FAILURE = 1

SYSTEM_FAILURE = 2

RESOURCE_FAILURE = 3.

CASE SY-SUBRC.

WHEN 0.

  • Administration of asynchronous tasks

WA_TASKLIST-TASKNAME = TASKNAME.

CLEAR WA_TASKLIST-RFCDEST.

APPEND WA_TASKLIST TO TASKLIST.

WRITE: / 'Started task: ', WA_TASKLIST-TASKNAME COLOR 2.

TASKNAME = TASKNAME + 1.

SND_JOBS = SND_JOBS + 1.

JOBS = JOBS - 1. "Number of existing jobs

IF JOBS = 0.

EXIT. "Job processing finished

ENDIF.

WHEN 1 OR 2.

  • Handling of communication and system failure

...

WHEN 3. "No resources available at present

  • Receive reply to asynchronous RFC calls

IF EXCP_FLAG = SPACE.

EXCP_FLAG = 'X'.

  • First attempt for RESOURCE_FAILURE handling

WAIT UNTIL RCV_JOBS >= SND_JOBS UP TO '0.01' SECONDS.

ELSE.

  • Second attempt for RESOURCE_FAILURE handling

WAIT UNTIL RCV_JOBS >= SND_JOBS UP TO '0.1' SECONDS.

ENDIF.

IF SY-SUBRC = 0.

CLEAR EXCP_FLAG. "Reset flag

ELSE. "No replies

"Endless loop handling

...

ENDIF.

ENDCASE.

ENDDO.

...

  • Receive remaining asynchronous replies

WAIT UNTIL RCV_JOBS >= SND_JOBS.

LOOP AT TASKLIST INTO WA_TASKLIST.

WRITE:/ 'Received task:', WA_TASKLIST-TASKNAME COLOR 1,

30 'Destination: ', WA_TASKLIST-RFCDEST COLOR 1.

ENDLOOP

...

FORM RETURN_INFO USING TASKNAME.

RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'

IMPORTING RFCSI_EXPORT = INFO

EXCEPTIONS

COMMUNICATION_FAILURE = 1

SYSTEM_FAILURE = 2.

RCV_JOBS = RCV_JOBS + 1. "Receiving data

IF SY-SUBRC NE 0.

  • Handling of communication and system failure

...

ELSE.

READ TABLE TASKLIST WITH KEY TASKNAME = TASKNAME

INTO WA_TASKLIST

IF SY-SUBRC = 0. "Register data

WA_TASKLIST-RFCDEST = INFO_RFCDEST.

MODIFY TASKLIST INDEX SY-TABIX FROM WA_TASKLIST.

ENDIF.

ENDIF.

...

ENDFORM

Thanks,

Naren

Read only

Former Member
0 Likes
587

Hi all,

I actually creating a sample code for that two..but how will I know using debugging that i actually doing it right...

Thanks!

Read only

alejandro_lpez
Contributor
0 Likes
587

Hi Diane,

Try this:

Put a break point where the function Module is called, execute the program that calls the function module, in debugg mode go to menu <i>Settings->Display/Change Debugger Settings, check the option Update Debugging and TRFC In Background Task</i>, click on button Save. Press F8 and then a new window would be open, the new window contains the code of the function module, follow with the normal debugg in the function module.

If this does not work, do some code on the function Module, like insert a value in Z table if the FM reach some point special inside the code.

Regards,

Alejandro.