What are lock objects?

The lock object is a feature included in the Advanced Business Application Programming (ABAP) Data Dictionary. They are used to maintain data consistency while inserting and updating data in a database.

In other words, when more than one program accesses the same data, the locking mechanism feature is used to maintain data consistency. This feature ensures that the data remains incorporated whenever it is modified or updated. The data in a table is locked by defining the lock object along with its key fields.

Lock mechanism

The lock mechanism facilitates the following functions:

  • It allows a user or program to interact with other programs about the data it is currently updating or reading and prevents other users from modifying the data simultaneously.
  • It avoids reading or modifying data that another program or user is currently accessing.


The locking mechanism works as follows:

Functioning of the lock mechanism
  1. The user creates a lock request and sends it to the Enqueue server. (The Enqueue function is used to insert objects into a queue.)
  2. The Enqueue server will create a lock in the table and set it to ‘read,’ ‘write,’ or ‘exclusive’ access.
  3. The program will receive the lockset information.
  4. At the end of the program, the program will interact with the enqueue server to release the locks. The server will release the lock applied to the data and remove the lock entry.

Function modules created by a lock object

Lock objects automatically create the following two function modules whenever a lock is activated.

  • ENQUEUE_<lockobjectname> - This function module sets the lock.
  • DEQUEUE_<lockobjectname> - This function module releases the lock.

Types of lock objects

There are three types of lock objects depending on the kind of access they give to users.

Read/Shared lock

The shared lock allows users to access the data in read-only mode, which means users cannot modify or write the data. If one user is accessing data using a shared lock and another user requests for a shared lock, the request is accepted. However, if another user requests an exclusive lock, the request will be rejected.

Write/Exclusive lock

The exclusive lock allows only the user who locked the data to read or write it. It rejects all exclusive lock requests made by users other than those who locked the data.

Enhance/Exclusive without cumulating lock

The same user can request exclusive locks multiple times, and each request can be handled successively. However, the exclusive lock without cumulating lock can be requested only one time by a user. This lock functions in the same way as the exclusive lock.

Creating a lock object

Below are the steps for creating a lock object using SAP ABAP editor.

Step 1: Open the SAP ABAP editor.

Step 2: Enter the code “SE11” in the transaction code input to navigate to the data dictionary.

Step 3: Choose the “Lock Object” button.

Step 4: Give a name to the lock object. It should begin with E—for example, ESLOCK2.

Step 5: Click Create.

Step 6: Give a short description of the lock object.

Step 7: Navigate to the Tables tab.

Step 8: Type the table name and change the lock mode to “Write.”

Step 9: Select the lock parameter tab and verify whether the primary key has been automatically added.

Step 10: Click Save and Activate.

Step 11: The lock object has been created successfully. To check the lock object, go to Lock Modules, and the lock object details will appear on the screen.

Changing lock objects

A lock object definition can be changed using the “Change” option after its creation. Below are the steps to follow for changing a lock object:

Step 1: Go to the SE11 transaction in SAP ABAP editor.

Step 2: On the initial screen of the editor, type the lock name that needs to be changed and click Change.

Step 3: Change the information that needs modification.

Step 4: Click Save. A success message will appear on the status bar indicating the information has been activated successfully.

Step 5: Click Activate and the new changes will be activated.

Deleting lock objects

To delete a lock object, follow the instructions given below:

Step 1: Open the SAP ABAP editor and go to the SE11 transaction.

Step 2: The initial screen of the ABAP dictionary will open.

Step 3: Type the lock object name that has to be deleted.

Step 4: Click the Delete button (available as the bin symbol on the menu).

Step 5: A confirmation popup will appear on the screen.

Step 6: Click Yes to confirm the process.

Step 7: The lock object will now be deleted. A success message will appear on the status bar.

Advantages of using lock objects

The advantages of using lock objects are as follows:

  • They prevent data collision in the same data record.
  • They prevent the generation of multiple copies of the same data.
  • They inform other programs and users that the data is being edited at the moment.
  • They ensure data integrity and uniformity across the record.
  • They prevent the same data from being displayed in different manners to different users.

Real-life applications of lock objects

Lock objects can be used widely in various applications such as transactions and online booking systems.

For instance, in an air flight ticket booking system, the application must ensure that two people do not book the same flight seat. It also has to ensure that the seats are not overbooked. To prevent such situations, the ticket booking application will have to use a lock object such that when one user has booked a flight seat ticket, it will be reflected within the system and other users cannot book the same ticket. Also, when the flight gets full, the status will be updated to all the users.

Similarly, when a user tries to book a movie ticket using an online booking application, the system will use a lock object to prevent overbooking.

Context and Applications

The topic lock object is an important topic taught in courses like:

  • Bachelor of Science in Computer Science
  • Master of Science in Computer Science
  • Bachelor of Science in Information Technology
  • Master of Science in Data Science and Analytics
  • Master of Science in Information Technology

Practice Problems

Q1. Which of these is a function module created by lock objects?

  2. Dynpro
  3. Primary table
  4. SAPscripts

Answer: Option a

Explanation: The two function modules created by lock objects are Enqueue and Dequeue.

Q2. Which of these is an application of lock objects?

  1. In subroutines
  2. In online booking systems
  3. In lock arguments
  4. To unlock objects

Answer: Option b

Explanation: Lock objects are used in online booking systems to avoid overbooking.

Q3. Which type of lock object allows users to access data in read-only mode?

  1. Shared
  2. Literals delete
  3. Exclusive define
  4. Locked define

Answer: Option a

Explanation: The shared lock allows users only to read the locked data.

Q4. Which of these is a type of lock object?

  1. Dynpro define
  3. Internal Tables
  4. Exclusive

Answer: Option d

Explanation: Exclusive lock is a type of lock object.

Q5. Which function module sets a lock?

  1. Modularization
  2. Locked
  3. Enqueue
  4. Exclusive

Answer: Option c

Explanation: The Enqueue function module sets a lock to the data.

Common Mistakes

Students often make mistakes in understanding the types of lock objects. They should carefully learn the functions of each type of lock object and know the difference between them.

  • ABAP classes
  • Internal tables
  • Modularization
  • Data elements
  • ABAP dictionary
  • Lock parameters

Want more help with your computer science homework?

We've got you covered with step-by-step solutions to millions of textbook problems, subject matter experts on standby 24/7 when you're stumped, and more.
Check out a sample computer science Q&A solution here!

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringComputer Science


Database connectivity

Lock objects

Lock Objects Homework Questions from Fellow Students

Browse our recently answered Lock Objects homework questions.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringComputer Science


Database connectivity

Lock objects