Skip to Content
avatar image
Former Member



Am I missing something with FOR UPDATE addition in Open SQL? When I use it I can't get a lock to appear to SM12. For example, if I select a single record for update from table EKKO it's still possible to effect a normal MEPO update of the releavnt purchase order even before a COMMIT WORK command in my code.

Any ideas?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Aug 02, 2010 at 03:28 AM

    This phrase from the SAP documentation should answer your query :

    An exclusive lock can be set for this line using the FOR UPDATE addition when a single line is being read with SINGLE.

    Source: [].

    This DB lock exists till the end of the current DB LUW & is released at the end.



    Add comment
    10|10000 characters needed characters exceeded

  • Aug 01, 2010 at 07:45 PM

    Hello Chris

    FOR UPDATE command creates only a database lock,

    you can't see database locks in sm12.

    You should use related "lock object" to lock entries in table EKKO with sm12

    For finding the lock object follow steps below :

    - Go to transaction se11

    - Write your table EKKO

    - Click button : Where Used List

    - Choose only "Lock object" in the next popup screen

    Every lock object has two function module ENQUEUE_<LOCK OBJ NAME> and DEQUEUE_<LOCK OBJ NAME>

    enqueue function creates lock in sm12 and dequeue deletes lock entry from sm12.

    And you can display parameters from se37 and use it.

    I hope it helps.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Bulent Balci

      Hi Bulent, Suhas and Sandra,

      Thank you all for your advice. As you say, the answer is really to use the SAP locking mechanism, therby gaining better control of the processes.