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.
- Exclusive Lock.
- Shared Lock.
- Exclusive but not cumulative lock.
The locked data can be read or proceed one user only. A request for another exclusive lock for a shared lock is rejected.
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