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

Former Member
0 Likes
591

Can anyone tell me little more about Lock Objects?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
561

Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.

SAP Provide three type of Lock objects.

- Read Lock(Shared Locked) - 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 cumulating) -works like a write lock except that the enhanced write lock also protects from further accesses from the same transaction.

You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.

Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.

Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.

Technicaly:

When you create a lock object System automatically creat two function module.

1. ENQUEUE_<Lockobject name>. to insert the object in a queue.

2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.

You have to use these function module in your program.

Also check this link.

http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm

Regards,

Maha

4 REPLIES 4
Read only

former_member182371
Active Contributor
0 Likes
561
Read only

Former Member
0 Likes
561

Go to transaction SE11,

click on radio button lock objects and read documentation.

theres lots of information given.

Regards

Read only

Former Member
0 Likes
561

Lock mode

Defines how to synchronize table record access by several users

Exclusive lock or read lock

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

Shared lock or write lock

Several users can read the same data at the same time, but as soon as a user edits the data, a second user can no longer access this data. Requests for further shared locks are accepted, even if they are issued by different users, but exclusive locks are rejected.

Exclusive but not cumulative lock

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

Main purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.

Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:

1. enque_lockobject

1. deque_lockobject

before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.

Read only

Former Member
0 Likes
562

Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.

SAP Provide three type of Lock objects.

- Read Lock(Shared Locked) - 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 cumulating) -works like a write lock except that the enhanced write lock also protects from further accesses from the same transaction.

You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.

Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.

Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.

Technicaly:

When you create a lock object System automatically creat two function module.

1. ENQUEUE_<Lockobject name>. to insert the object in a queue.

2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.

You have to use these function module in your program.

Also check this link.

http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm

Regards,

Maha