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

lock issue: program with multi-BAPIs run by multiple users

Former Member
0 Likes
845

Hi,

We have 3 programs and each programs call more than 1 BAPIs ( BAPI_GOODSMVT_CREATE) to do good movement of an equipement. But we got a LOCK probelm when multiple users running the programs at the same time.

Inside the programs. we do...

1st bapi

1. set update task local.

2. BAPI_GOODSMVT_CREATE

3. 'BAPI_TRANSACTION_COMMIT with WAIT = 'X'

2nd Bapi

4 set update task local.

5. BAPI_GOODSMVT_CREATE

6. 'BAPI_TRANSACTION_COMMIT with WAIT = 'X'

3rd bapi

4th Bapi

....

When we have multiple users running those programs at the same time (with the same material but different serial number) , we got an error said that 'The plant data of the material XXXX is locked by user YYYY'. The program got interupt in the half way of processing, eg. 1st and 2nd BAPI are done and got Lock error at the 3rd bapi.

I tried to lock the program at the beginning using ENQUEUE. But seems like all locks are removed inside 'BAPI_TRANSACTION_COMMIT'.

Is there any way we can prevent it??

Regards,

Louise

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
622

Hi,

Welcome to SDN.

I find COMMIT work clears table level locks . We have applied a round way soluion.

We have created a custom table whenever programs runs with Multiple Dependent BAPI's we updated the custom table before calling 1st BAPI and clear after the last BAPI call, so at time only single users can go execute the programs.

But i am not 100% agree with this solution.

a®

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
623

Hi,

Welcome to SDN.

I find COMMIT work clears table level locks . We have applied a round way soluion.

We have created a custom table whenever programs runs with Multiple Dependent BAPI's we updated the custom table before calling 1st BAPI and clear after the last BAPI call, so at time only single users can go execute the programs.

But i am not 100% agree with this solution.

a®

Read only

Former Member
0 Likes
622

> Louise,

Is the data you are updating in the second or third call of the BAPI dependent on the ones before that ? If not,

Why dont you try this :

Call : BAPI_GOODSMVT_CREATE (1)

Call BAPI_GOODSMVT_CREATE (2)

Call BAPI_GOODSMVT_CREATE (3)

Then Commit.

Going by your solution, the lock should now work as you have only one commit at the end of the program .

Read only

0 Likes
622

Thanks!!

Unfortunately the BAPIs are dependent on the ones before that and we need to call commit after each bapi.

Louise