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

How did you solve 'lock' problem, when doing a job with parallel processing?

former_member282589
Participant
1,892

Hello.

Well, If there is a scenario, who want to do mass transfer of material, between storage location.

You have number of material which are maintain with different batch no, but same material number.

First of All, With using BAPI, It'll lock the material you're using - so it can't be processed with other parallel processing.

If you update your result in Z-tables, If 2 jobs are completed simultaneously, the Z-table is locked because a job is locking the table, making other job can't be updated - because table is locked by other job.

Any advice on this situation?

3 REPLIES 3
Read only

AlbertoR
Participant
0 Likes
1,501

I used the FM ENQUEUE_ESINDX, as suggested by rich.heilman in his answer to this post Locking a Report | SAP Community

Read only

0 Likes
1,501

Well, I know there is a 'enquene' concept of SAP.. but the problem is 'wait until the locked object is completed'.
Do I have to do use do-enddo clause?

Read only

0 Likes
1,501

Indeed you will have to use a loop. First decide how long you want the process to wait to, then create a loop where you have four things:

1. The call to ENQUEUE_ESINDX

2. Check if the lock could be done successfully and if so, exit the loop and go on with processing

3. If locking could not be done, use instruction WAIT UP TO xx SECONDS in order to give the other process time to unlock once finished

4. Decrease a variable that you defined beforehand to decide how long you want to wait