2007 Jul 18 7:14 AM
1. How to create lock object in the data dictionary, please give the step by step procedure if possible?
2. what is the use of lock object ?
3. Give me the scenario where can we use exactly?
2007 Jul 18 7:17 AM
Hi,
<b>Creating Lock Objects:</b>
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
<b>Use Of Lock Objects:</b>
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.
For More Info,
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eef3446011d189700000e8322d00/frameset.htm
Regards,
Padmam.
2007 Jul 18 7:16 AM
Hi
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.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
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.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
Lock objects:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Match Code Objects:
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
See this link:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Check these links -
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 18 7:17 AM
Hi,
<b>Creating Lock Objects:</b>
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
<b>Use Of Lock Objects:</b>
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.
For More Info,
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eef3446011d189700000e8322d00/frameset.htm
Regards,
Padmam.
2007 Jul 18 7:18 AM
HI,
1) Goto SE11.
2) Select Lock object radio button
3) Enter the name Starting with EZ or EY.
4) Then click on create.
In the Creation select the lock type you want and also the table.
Also the function group in whihc you want to generate the FM's ENQUEUE and DEQUEUE_LOCK_OBJECT.
Regards,
Sesh
2007 Jul 18 7:21 AM
Hi, Actually lock objects are used to restrict the acces to the particular database table. There are 3 types of locks are there Exclusive Locks, Shared Lock, Exclusive cumulative Locks.
To create lock objects follow below steps
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function modules to lock and unlock the records..
for more information on the lock objects goto se11 and select lockonjects tab and press f1 u will get the info and about the different lock give the lock name starting with EY or EZ click create in that u will get 3 lock objects select any one and click F1 u will get info about those.
if you want more information on lock objects follow the link
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
2007 Jul 18 7:23 AM
1. How to create lock object in the data dictionary, please give the step by step procedure if possible?
Go to se11. give lock name starting with EZ or EY.
Give the table name and lock mode and the lock parameters(the fields in the table)
By activating this lock object, 2 function modules will b created.
ENQUEUE_<UR_LOCKOBJECT_NAME>
DEQUEUE_<UR_LOCKOBJECT_NAME>
2. what is the use of lock object ?
When more than 1 pgm acces the same data at the same time, we should lock the data. otherwise inconsistency can occur.
Database itself is giving some lock options. but tht lock will be unlock automatically after each COMMIT. thts y sap itself is giving some option for creating locks.
3. Give me the scenario where can we use exactly?
IF one flight only 1 ticket is remaining.
2 users c that 1 ticket is remaining. and they start booking that ticket. what will happen here without lock. ( Inconsistency)
I think u got the point.
So in the code for locking we have to call the function module
ENQUEUE_<UR_LOCKOBJECT_NAME>.
<b>Rewards if useful</b>
regards,
Nikhil
2007 Jul 18 7:30 AM
<u><b>Creation of Lock Object:</b></u>
i) Go to SE11 -
> select LockObject -
> give the name of lock object The name of the lock object should begin with E.----
> then select 'CREATE' button.
ii) Provide the name of primary table----
>select the lock mode ( exclusive,cumulative/shared/exclusive,nnot cumulative).
iii) Select the tab 'LOCK PARAMETER' -
> provid ethe lock parameters.
iv) Save and activate.
<u><b>Use of lock Object:</b></u>
A lock object is a virtual link of several SAP tables which is used to synchronize simultaneous access by two users to the same set of data ( SAP lock concept).
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.
<i><b>Rewards point for helpful answer
Debjani Lahiri</b></i>