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 Error with BAPI call

Former Member
0 Likes
1,343

Hi all,

We are using the BAPI call to the FM BAPI_GOODSMVT_CREATE for goods recipt posting.

When we have multiple PO's the first PO is posted succesfully and the next PO gives a locking error as "The plant data of the material <material number> is locked by the user <usedrid> "

How to dequeue the plant data for the material? Is there any specific function module ?

Regards,

stk

6 REPLIES 6
Read only

former_member188827
Active Contributor
0 Likes
904

use fm 'DEQUEUE_ALL' after bapi call

Read only

tarangini_katta
Active Contributor
0 Likes
904

Hi stock.

try this.

DEQUEUE_E_MATNR_LOCK

if does not work serch in SE37 DEMATNR*.

U will get so many function modules.May be some thisng will help u

Thanks

Read only

0 Likes
904

Hi ,

Both DEQUEUE_E_MATNR_LOCK and DEQUEUE_ALL doesnt remove the lock...

But when i check the program in debug mode the lock is removed and the posting is done.

still problem persists.

thnks

Read only

0 Likes
904

Your BAPI sets a lock using ENQUEUE. Using debug or just looking at the code, (or I think there is a trace somewhere), you can find the FM used to do the ENQUEUE. What you need to do, is in a loop, try to get the same lock, using the same ENQUEUE function module. If you can't get a lock, then it means that BAPI processing hasn't quite finished. So use FM Enque_Sleep to sleep for a number of seconds. Then try and get a lock again.

When you get a lock, immediately release it (Using a DEQUEUE FM with exactly the same params, and do your next task.

Don't use DEQUEUE_ALL. You don't want to inadvertantly remove a lock that you actually need. That way lies db corrupution.

Read only

0 Likes
904

hi, can you give me code example of it....??

table S021 no update after bapi commit..

Read only

Former Member
0 Likes
904

Called BAPI_TRANSACTION_COMMIT after the posting BAPI call.