‎2007 Jan 04 2:39 PM
im aware of how to create lock objects.
but dont know how to use them exactly and where can anybody give me with example and how to use lock objects .
thanks
‎2007 Jan 04 2:41 PM
‎2007 Jan 04 2:41 PM
‎2007 Jan 04 2:43 PM
Hi,
Lock object is an aggregated dictionary object and can be defined by using the following steps:
o From initial data dictionary screen, enter the name for the object, Click Lock object radiobutton and then click on Create. The system displays a dialog box for Maintain Lock Objects screen
o Enter short text as usual and the name for primary table.
o Save
o Select Tables option
From this screen you can:
Select secondary tables, if any, linked by foreign key relationship.
Fields for the lock objects. This option allows you to select fields for objects (R/3 system allows locking up to record level). Lock object argument are not selected by user but are imposed by the system and includes all the primary keys for the table.
When you activate the lock object, the functions are automatically generated. And these are ENQUEUE-EZN and DEQUEUE-EZN. EZN is name of the lock object.
While ENQUEUE is used in program to set the code over the selected data depending upon the lock object arguments. DEQUEUE is used to release the lock.
Thanks,
Vinay
‎2007 Jan 04 2:44 PM
Hi ,
We can use the function modules ENQUEUE_E_TABLE for locking tables and the function module DEQUEUE_E_TABLE for unlocking tables. With this method, we don't need to lock objects in order to lock the tables. In other words, any table can be locked/unlocked using these function modules.
report ztest.
* testing the locking of tables...
data:
varkey like rstable-varkey.
varkey = sy-mandt.
* locking the tables............................
call function 'ENQUEUE_E_TABLE'
exporting
* MODE_RSTABLE = 'E'
tabname = 'MARA'
varkey = varkey
* X_TABNAME = ' '
* X_VARKEY = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = 'X'
exceptions
foreign_lock = 1
system_failure = 2
others = 3
.
case sy-subrc.
when 1.
message i184(bctrain) with 'Foreignlock'.
when 2.
message i184(bctrain) with 'system failure'.
when 0.
message i184(bctrain) with 'success'.
when others.
message i184(bctrain) with 'others'.
endcase.
* unlocking the table...............
call function 'DEQUEUE_E_TABLE'
exporting
* MODE_RSTABLE = 'E'
tabname = 'MARA'
varkey = varkey
* X_TABNAME = ' '
* X_VARKEY = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
.
Regards,
Raghav
‎2007 Jan 05 4:33 AM
HI
Lock objects are used to synchronize access to the same data by more than one program.look at the above examples,its good.
Example:
Just have a look at these links:
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eebf446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eebf446011d189700000e8322d00/frameset.htm</a>
Regards,
Gunasree.
‎2007 Jan 05 4:39 AM
Hi,
Do the following 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..
Some more information is here.
http://help.sap.com/saphelp_nw2004s/helpdata/en/2d/198c37bf76454aa4058d8af3d806ab/frameset.htm
-charitha.
‎2007 Jan 06 7:43 AM
Lock objects are created not for locking the Table, It is for locking the particular object for example Material number , Sales order No etc.
Here the objects are Business entities such as Material Number, Sales order no,
Invoice No.
Whenever a lock object is created, it creates two function modules
ENQUEUE_*******
DEQUEUE_*******.
To Lock a particular object U need to call the function module ENQUEUE_*******,
& to unlock call the function module DEQUEUE_*****.
Kindly award points if the answer is usefull.
With regards
K.Varadharajan
‎2007 Feb 24 10:33 AM