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 objects

Former Member
0 Likes
806

what are lock object ?,when do i need to use look objects?how do i create?how many types of locks? how do i implement lock objects

5 REPLIES 5
Read only

Former Member
0 Likes
786

Hi Aravind,

Lock objects are used to synchronize the access to the same data by more than one program.Tcode : SE11 can be used to create the lock objects.

Please go through the below path which explains about the Lock objects.

http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm

Suggest you to go through the forum postings also to understand in depth.

Hope this helps.

Please reward points if useful.

Thanks,

Srinivasa

Read only

Former Member
0 Likes
786

Hi aravind,

U can create lock objects through SE11. there r 3 types of lock objects r there.

1. Exclusive, cumulative

2. shared

3. Exclusive, not cumulative

if 2 users r trying to update the same table etc, inorder to restrict the other user we have to use lock objetcs.

Reward if help ful.

Regards

Venkat

Read only

varma_narayana
Active Contributor
0 Likes
786

Hi..

Lock objects are Created on DB tables to Lock the Records of table from simultaneous access of several users.

Procedure.

1. Create Lock Object for the Table in SE11. (Name starts with EZ or EY)

Activate the Lock object.

It will genereate 2 FMs : ENQUEUE_<LOCKOBJ> "To lock the record

DEQUEUE_<LOCKOBJ> "To unlock the record

2. Call these two FMs from your program

CALL FUNCTION 'ENQUEUE_<LOBJ>.

IF SY-SUBRC = 0.

UPDATE <TABLE>.

CALL FUNCTION 'ENQUEUE_<LOBJ>.

ENDIF.

<b>Reward points if Helpful. </b>

Read only

Former Member
0 Likes
786

Lock objects are used to synchronize access to the same data by more than one program.

General information about the lock mechanism.

You can synchronize access by several programs to the same data with a logical lock mechanism. This lock mechanism fulfills two main functions:

A program can tell other programs which data records it is just reading or changing.

A program can prevent itself from reading data that is just being changed by another program.

When accessing data records, the records just being edited by other programs can be identified by the entry in the lock table. Such an entry for the lock must define a number of fully specified key fields, that is either a value is passed for the key field or this field is locked generically.

To set locks, a lock object must be defined in the ABAP Dictionary. When this lock object is activated, two function modules (see Function Modules for Lock Requests) are generated with the names ENQUEUE_*reward for useful answers*</b>

Read only

Former Member
0 Likes
786

<b>what are lock object?</b>

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

You can create a lock on a object of SAP thorugh transaction SE11

<b>when do i need to use look objects?</b>

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.

<b>how do i create?</b>

You can create a lock on a object of SAP thorugh transaction SE11

<b>how many types of locks?</b>

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.

<b>how do i implement lock objects ?</b>

. 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.

<b>Veryuseful link.</b>http://help.sap.com/saphelp_nw04s/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm

<a href="http://help.sap.com/saphelp_nw04s/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm">Lock Concept</a>

<b>Reward if helful</b>