Skip to Content
author's profile photo Former Member
Former Member

locking issue with BAPI_GOODSMVT_CREATE


Has anybody ran across a problem of lock objects (related to materials) not getting released when BAPI_GOODSMVT_CREATE fails?

Here is the sequence of events:

1. I run my function (which calls BAPI_GOODSMVT_CREATE) in SE37 and force an error (i.e. return table contains entries). I do NOT leave SE37.

2. In another session I run the same test again (but with correct data). I get error M3 897 (The plant data of the material 3319 is locked by user USCLXH90).

By looking in SM12 after step 1 is finished, I have noticed that 2 lock entries do not get released. These lock entries subsequently cause the error in step 2.

Lock Object: ENQARRAY

Tables: MARC, MBEW

Arguments: material and plant used in my test


A. These lock objects do finally get released once I completely exit SE37.

B. These lock objects get released immediately and automatically if step 1 is successful (in other words, it's only when there is an error do the lock objects remain!)

C. I do call BAPI_TRANSACTION_COMMIT. I have also tried using SET UPDATE TASK LOCAL. Neither makes any difference (I think these are irrelevant b/c there are no db updates anyway in step 1 b/c of the error I force).

D. We have seen this specific problem occur when calling the function via RFC from our web front end.

I couldn't find any OSS note that describes this problem. Anybody know how to guarantee that all lock objects get released in the case where BAPI_GOODSMVT_CREATE fails?

p.s. I am a doing a 541 movement type (although I don't think this problem is specific to movement types).

Thanks for any suggestions or insights anybody might have.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Feb 11, 2005 at 08:41 PM

    I've used this BAPI in many of my programs, and always after the call, I code.....

        commit work and wait.
        call function 'DEQUEUE_ALL'.

    The DEQUEUE_ALL show release any/all locks.


    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Rich Heilman

      Sorry, "session" is probably not the correct word I should have used.... rather, is this function <i>transaction</i> specific? (because I don't want the all locks for the user in the system released - only those pertaining to the current transaction). Logically, I would assume it's only for the current transaction, but I am just trying to make sure I'm not using some "all encompassing" function that just goes and removes all locks in the system for that user.

      ....anyway, OSS note 3013 seems to answer my question 😊

      Thanks for your help!



      > I gotta say that it will release locks for that

      > "session" only, otherwise what's the point in

      > applying locks in the first place, right?


      > Regards,

      > Rich Heilman

  • Posted on Feb 11, 2005 at 09:08 PM

    Hi Lee,

    Did you set the parameter 'WAIT' to 'X'? This will ensure that all the updates are completed and the locks are released, before the next call of the BAPI.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.