Application Development 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: 

Can I use BAPI BAPI_GOODSMVT_CREATE with Parallel Processing?

former_member282589
Participant
0 Kudos

Currently, I'm wondering I can improve current program with Parallel Processing -

I have to make 70,000 GI/GR Documents with BAPI, and it takes a lot of time.. So I want to split into smaller packages AND do some Parallel Processing to split WP.

So I make test-run program, which makes 50 Document, which splits to 10 WP Like this :

DO 50 TIMES.

WAIT UNTIL g_progs LE pa_wpnum.

CALL FUNCTION 'Z_PARA_TEST'
STARTING NEW TASK g_task DESTINATION IN GROUP ' 390'
PERFORMING return_z_para_test ON END OF TASK
exceptions
resource_failure = 3.

CASE sy-subrc.
WHEN 3.
WAIT UNTIL g_progs < 3 UP TO '20' SECONDS.
ENDCASE.

ADD 1 TO g_task.
ADD 1 TO g_progs.
ADD 1 TO g_sprog.

ENDDO.

FORM return_z_pp_para_test USING taskname.

SUBTRACT 1 FROM g_progs.

ADD 1 TO g_eprog.

gt_chk_message-message = 10.
APPEND gt_chk_message.

ENDFORM.

* Z_PARA_TEST has BAPI_GOODSMVT_CREATE -> BAPI_TRANSACTION COMMIT functions.

It turns out, I looped 50 times(it shows 50 lines of '10' writings). But Only makes 1 documents!

So..My question is :

1. Do BAPI_GOODSMVT_CREATE works with Parallel Processing? Or am I doing Wrong?

2. I think Document Number will be same, If each WP is working too fast. It could be a problem?


1 ACCEPTED SOLUTION

gdey_geminius
Contributor

You can do it with BAPI as I recon. Please pass 'X' to the importing parameter of FM "BAPI_TRANSACTION_COMMIT". Below thread for reference for parallel processing in SAP.

https://blogs.sap.com/2019/03/19/parallel-processing-made-easy/

Thanks,

Gourab

6 REPLIES 6

Sandra_Rossi
Active Contributor
0 Kudos

Any BAPI works well with parallel processing.

Do you execute the BAPI correctly, and did you check its return message?

Number ranges should not be a problem (few issues sometimes like performance, number gaps, order of numbers, but it doesn't prevent successful execution).

gdey_geminius
Contributor
0 Kudos

Instead of doing the parallel processing, you can split the file to multiple file and run the program multiple times con-currently.

Thanks,

Gourab

0 Kudos

Yes. That could be answer - but Why I'm using parallel processing is.. avoid 'using multiple tabs to run a problem'.

It's actually parallel processing with manual as I know of?

former_member282589
Participant
0 Kudos

Found the problem :

Between the Do ~ Enddo, I have to delay some time(I used Wait up to '0.5' seconds).

But It makes different problem - In smaller pockets,

It overweighs actual process time without Parallel Process!


So, I'm currently find the way to minimal 'wait time' between DO - ENDDO.

Any Idea would be appreciated.

gdey_geminius
Contributor

You can do it with BAPI as I recon. Please pass 'X' to the importing parameter of FM "BAPI_TRANSACTION_COMMIT". Below thread for reference for parallel processing in SAP.

https://blogs.sap.com/2019/03/19/parallel-processing-made-easy/

Thanks,

Gourab

0 Kudos

Also, one more thing you have to consider while uploading "70,000" records is how to handle reprocess the error record. This will be troublesome for uploading these many record in a single go. You also have to consider the uploading time of the 70000 records. Instead you can split the record to 5000 record in each file and upload once.

Else you can read only 5000 record from the same file and process(the file will be 1, but you will only read 5000 record at a time) and you can run the program simultaneously in 6 session. So that it will be easy in production. You can plan for a complete day cut-over in PRD in the week off and proceed so that it will easy and error free.

Technically it is possible to do the BAPI in parallel process. Though it is technically possible but will be difficult for tracing of any error for a single go.

Thanks,

Gourab