Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

lock object types

Former Member
0 Likes
475

hi experts,

i want to know types of lock objects like exclusive,

shared, exclusive&cumulative. etc..

can anybody help me and explain briefly.

regards,

prerna.

4 REPLIES 4
Read only

Former Member
0 Likes
446

Check out Naresh's answer in the below thread...

REgards,

Santosh

Message was edited by: Santosh Kumar P

Read only

Former Member
0 Likes
446

Hi check this,

The description of an SAP lock to a table is made via the lock condition and the lock mode.

Read lock (shared lock)

protects read access to an object. The read lock allows other transactions read access but not write access to the locked area of the table.

Write lock (exclusive lock)

protects write access to an object. The write lock allows other transactions neither read nor write access to the locked area of the table.

Enhanced write lock (exclusive lock without cumulation)

works like a write lock except that the enhanced write lock also protects from further accesses from the same transaction.

Jaffer vali shaik

Read only

Former Member
0 Likes
446

There are two types of lock in the R/3 System:

Shared lock

Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to change the object. It does not, however, prevent other programs from setting further read locks.

Exclusive lock

Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.

Lock Duration

When you set a lock, you should bear in mind that if it remains set for a long time, the availability of the object to other transactions is reduced. Whether or not this is acceptable depends on the nature of the task your program is performing.

Remember in particular that setting too many shared locks without good reason can have a considerable effect on programs that work with database tables. If several programs running concurrently all set a shared lock for the same application object in the system, it can make it almost impossible to set an exclusive lock, since the program that needs to set that lock will be unable to find any time when there are no locks at all set for that object. Conversely, a single exclusive lock prevents all other programs from reading the locked object.

At the end of an SAP LUW, you should release all locks. This either happens automatically during the database update, or explicitly, when you call the corresponding dequeue function module. Locks that are not linked to a database update are released at the end of the SAP transaction.