‎2011 Mar 13 5:58 PM
Hello,
I am updating/modifying/deleting the records from a Z table. I am thinking to use the standard FMs 'ENQUEUE_E_TABLE' and 'DEQUEUE_E_TABLE' while am working with it.
Or do i need to create a lock object and use that lock object, while am working with this Z table in my prog.?
When i have to use 'ENQUEUE_E_TABLE' and 'DEQUEUE_E_TABLE' FMs and when i have to use a lock object?
Thank you
‎2011 Mar 13 6:24 PM
Hello,
You do not to create lock object. You can lock the table with 'ENQUEUE_E_TABLE' and unlock with 'DEQUEUE_E_TABLE'.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = W_MODE
TABNAME = W_TABLE
VARKEY = W_VARKEY
_SCOPE = '3'
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2.
Thanks,
Venu
‎2011 Mar 13 6:24 PM
Hello,
You do not to create lock object. You can lock the table with 'ENQUEUE_E_TABLE' and unlock with 'DEQUEUE_E_TABLE'.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = W_MODE
TABNAME = W_TABLE
VARKEY = W_VARKEY
_SCOPE = '3'
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2.
Thanks,
Venu
‎2011 Mar 13 7:03 PM
Hi,
Yes, there is no need to go for Lock object. Just check this code:
call function 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = 'ZTABLE'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
others = 3.
if sy-subrc = 0.
modify ZTABLE from table itab.
if sy-subrc = 0.
commit work.
endif.
call function 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = 'ZTABLE'.
endif.http://wiki.sdn.sap.com/wiki/display/Snippets/lockingandunlocking+tables
Thanks,
Naveen Inuganti