2008 Jun 12 5:19 AM
what is lock table
2008 Jun 12 5:37 AM
Hi
1)Go to se11 transaction.
2)Click on lock object radio button and give a lock object name starting with 'E'.For example 'ESAMPLE'.Click CREATE.
3)In the TABLE tab, you can give the table name for which you require a lock.In the LOCK PARAMETERS tab,you can give the table fields based on which the table should be locked.
4)Call a function module in your program ENQUEUE_lockobjectname to obtain a lock on the required table.In our example the FM will be ENQUEUE_ESAMPLE.
5)To release the lock on the table,call the function module DEQUEUE_lockobjectname.In our example the FM will be DEQUEUE_ESAMPLE.
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
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
<REMOVED BY MODERATOR>
preet
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:21 AM
2008 Jun 12 5:39 AM
Hi Sudheer,
Search in the Forum threads
u will find many...
Regards
Karan
2008 Jun 12 5:51 AM
Hi,
Lock table:This is nothing but locking the Database Table for
Doing some opertaions like inserting data or changing data entries.
Lock objects are used 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.
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.
<REMOVED BY MODERATOR>
Regards,
Raj.
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:22 AM
2008 Jun 12 5:58 AM
Hi,
Two or more linked database tables can share a common lock.
The lock, to be applied, is specified in the lock objects in foreign key relationships. When a lock object is created two function modules are automatically generated.
To create a lock object, a function module with the prefix ENQUEUE_ is created to set the lock and a function module with the prefix DEQUEUE_ is created to remove the lock.
Lock are useful to prevent inconsistent update of data.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:22 AM
2008 Jun 12 9:17 AM
Hi Sudheer.
Please use SDN's search function for this type of questions. There are a lot of similar questions and there is no need to ask them once again.
I will lock this thread
Best regards,
Jan Stallkamp
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |