Application Development 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: 

what are the variout types of lock objects

Former Member
0 Kudos

hi gurus,

plz anybody inform me what is lock object

y we use that one

what r the various types of lock objects we have

thank you

kals.

4 REPLIES 4

paruchuri_nagesh
Active Contributor
0 Kudos

hi

Locks are requested and released in the programming of online transactions by calling certain function modules which are automatically generated from the definition of the lock objects. These lock objects must be explicitly created in the ABAP Dictionary.

To set locks, you must perform the following steps:

1. You must define a lock object in the ABAP Dictionary. The name of the lock object should begin with E.

2. The function modules for requesting and releasing locks which are created automatically when the lock object is activated must be linked to the programming of the relevant online transactions.

three types of lock objects

Access by more than one user can be synchronized in the following ways:

Exclusive lock: The locked data can only be displayed or edited by a single user. A

request for another exclusive lock or for a shared lock is rejected.

Shared lock: More than one user can access the locked data at the same time in display

mode. A request for another shared lock is accepted, even if it comes from another user.

An exclusive lock is rejected.

Exclusive but not cumulative: Exclusive locks can be requested several times from the

same transaction and are processed successively. In contrast, exclusive but not

cumulative locks can be called only once from the same transaction. All other lock

requests are rejected.

reward if u find useful

regards

Nagesh.Paruchuri

Former Member
0 Kudos

Former Member
0 Kudos

Hi

<b>Lock Objects</b>

Lock object concept

Lock modes

Creating a lock object (example)

Lock object sample code

<b>Lock Objects</b>

SAP data dictionary provides you with a locking mechanism to synchronize simultaneous data access by different users.

Lock objects are created in SE11.

Customer lock objects must begin with EY or EZ .

Three possible lock modes exist for lock objects.

<b>Lock Mode</b>

Lock mode E: This sets a lock for changing data for single user. This lock can be accumulated.

Lock mode X: This mode is used like mode E for changing data. The only technical difference from mode E is that the respective lock does not allow accumulation.

Lock mode S: This mode ensures that data displayed in your program cannot be changed by other users during the entire display time. Here you do not want to change the data yourself (allows read only access for data).

<b>Creating Lock object</b>

Enter lock object name beginning with EY or EZ

and hit create.

Enter table names containing data records that should be locked and the lock mode.

The primary keys of the specified tables are automatically selected as lock parameters.

To set a lock in the application program

call a function module ENQUEUE_<LOCK_OBJECT>.

For our example, it would be ENQUEUE_EZMARA.

To release the lock in the application program

call a function module DEQUEUE_<LOCK_OBJECT>.

For our example, it would be DEQUEUE_EZMARA.

Refer the code executed by user (say abap1) for

matnr = ’000000000000000012’.

<b>Reward if usefull</b>

Former Member
0 Kudos

Hi Kalyan,

There are 3 major types of Locks:

Exclusive Cumulative Mode.

Generally a lock object is used to prevent access by more than one person, and this is the lock mode that actually prevents that. This mode is generally the mode that will be used throughout your work.

Shared Mode.

Shared mode is a Read Lock. It allows other users to read the data, but not to write to it. Generally, when I am just displaying data, I do not lock the record at all, however, shgould the occasion arise whereby you must prevent the change of the data whilst just viewing it, then this is the lock mode to specify.

Exclusive Not Cumulative Mode.

In the Exclusive mode detailed above, the same transaction can reread the data from the same record as and when required. This mode prevents that. In other words, this mode locks the record in the table even against the program requesting the lock.

Refer http://www.erpgenie.com/abaptips/content/view/376/62/ for more details.

Reward if useful.

Regards,

Chitra