Using Lock Objects on OPEN SQL statements


Using lock objects with OPEN SQL statements in SAP ABAP programming

A+ A-

Lock Objects

Lock objects are used to synchronize the multiple set of users who are accessing the same set of data.

There are three types of locks.

  1. Exclusive Lock.
  2. Shared Lock.
  3. Exclusive but not cumulative lock.
Exclusive Lock

The locked data can be read or proceed one user only. A request for another exclusive lock for a shared lock is rejected.

Shared Lock

Several users can read the same data at the same time, but as same as a user edits the data,a second user can not longer access this data. Requests for further shared locks are accepted, but exclusive locks are rejected.

Exclusive but not cumulative lock.

Exclusive locks can be requested by the same user more than once and handled successfully, but an exclusive but not cumulative lock can only be requested once by a given user, all the other lock requests are rejected.

Use of lock objects

Lock objects are used when ever we are modifying or updating or inserting or deleting the database table data using OPEN SQL statements.

Lock objects are part of data dictionary objects, when ever we create a lock object using data dictionary, two function modules will be generated automatically in the back end.

All custom objects in SAP starts with Y or Z except lock objects.Lock objects starts with EZ or EY.

Name of the generated function modules are with following naming convention .

ENQUE_<LOCK OBJECT NAME>. "USED TO PUT A LOCK ON DATABASE TABLE RECORD
DEQUE_<LOCK OBJECT NAME>. "USED TO RELEASE LOCK ON DATABASE TABLE RECORD
*HERE <LOCK OBJECT NAME> IS THE LOCK OBJECT NAME WHICH IS CREATED IN DATA DICTIONARY

Learner Questions

No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question


    Was this lesson helpful to you? Yes No 21 People out of 25 think this lesson helpful

    Lesson Navigation

    ←Previous Chapter
    Next Chapter →