‎2009 Jul 07 10:02 AM
Hi All,
I have a requirement where in I have to insert a bunch of data into a standard table using some function module. I want to lock the table for the others to insert/modity the records during my insertion. Please help me provide the procedure how to lock a table for write access for others.
thanks and regards,
Naresh
‎2009 Jul 07 12:29 PM
Hi,
Activating a lock object in the ABAP Dictionary automatically creates function modules for setting (ENQUEUE_<lock object name>) and releasing (DEQUEUE_<lock object name>) locks.
then you can use the ENQUEUE_<lock object name> in program or FM for locking the table.
A lock object is first need to be created between table which are used.
Manish
‎2009 Jul 07 2:52 PM
Hi Manish,
Thanks for your update. But I already tried it. In that process I can only lock the table for a particalar entry each time. But I want to lock the table for a bunch of entries at a single shot. Because I am doing a mass update.
thanks and regards,
Naresh
‎2009 Jul 07 3:05 PM
Hi,
Try function Module 'ENQUEUE_E_TABLE' and 'DEQUEUE_E_TABLE'.
Regards,
Himanshu Verma
‎2009 Jul 07 3:11 PM
Hi Naresh,
When you say "the others to insert/modity the records during my insertion", you need to determine how those other change the table and find the lock object that uses (transaction SM12). If that locks entries in the table individually, that's what you might have to do.
Regards,
Nick
‎2009 Jul 07 3:34 PM
Hi Verma,
what should be passed to VARKEY. If possible can you please give me an axample.
thanks,
Naresh
‎2009 Jul 07 3:51 PM
Hi,
VARKEY is an optional parameter this is used is you want to lock the table based on certain field values like if you want to lock BKPF based on company code then you ahve to pass that to this variable if you want to lock table irrespective of any vlaues you can just pass the table name to this function module and that should do the trick...
Regards,
Himanshu Verma
‎2009 Jul 08 5:31 AM
Hi,
If you want to apply for bunch of records , you can use loop for it .
LOOP.
" some processing
PERFORM lock record. " ENQUEUE
" some processing again
APPEND record TO update_table.
ENDLOOP.
Thanks
Manish
‎2009 Jul 09 1:02 PM
Hi,
Please go to this link.It may help you.
http://help.sap.com/abapdocu/en/ABENDB_LOCK.htm
Rewsrd if helpful.
Thanks,
LN
‎2009 Jul 09 1:48 PM