‎2006 Sep 18 10:26 AM
‎2006 Sep 18 10:31 AM
http://help.sap.com/saphelp_di471/helpdata/EN/cf/21ea0b446011d189700000e8322d00/frameset.htm
how to lock and unlock object...
fm used...ENQUEUE_E_TABLE
ex...
*----
lock Table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = table_name
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
*----
Unlock Table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = table_name
refer for more....
‎2006 Sep 18 10:38 AM
Hi,
For the parameters, it is freely design by you. But always remember that the lock key should be always representing the unique record of the table. Otherwise it defeat the purpose of locking.
Pls have a look on FMs ENQUEUE_E_TABLE and DEQUEUE_E_TABLE as well. If your table is "Maintenance" allowed. You have to use these FMs as well to achieve the exclusive lock of your object. Because the table is accessible via SM30.
Hope it helps.
‎2006 Sep 18 10:53 AM
hi Rahul,
steps
1.first generate a lock object on a perticular table in se11
2. start lock object eith EZtabname then .
3.where u want to use that lock object call function ENQUEUE_lockobjname
4.pass lock mode and fields u want to lock
5 for unlock call function DEQUEUE_lockobjname
bellow is the sample example
REPORT ZPLOCKSS MESSAGE-ID sabapdocu.
Tables ZPEMP.
CALL FUNCTION 'ENQUEUE_EZPLOCK'
EXPORTING
MODE_ZPEMP = 'S'
MANDT = SY-MANDT.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write: / 'Lock gained',sy-uzeit.
select * from ZPEMP.
write: / ZPEMP-EMPNO,ZPEMP-FNAME,ZPEMP-MNAME.
endselect.
wait up to 60 seconds.
CALL FUNCTION 'DEQUEUE_EZPLOCK'
EXPORTING
MODE_ZPEMP = 'S'
MANDT = SY-MANDT.
write: / 'Lock released',sy-uzeit.
‎2006 Sep 18 11:02 AM
hi,
chk this simple code.
*----
lock Table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = table_name
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
*----
Unlock Table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = table_name
rgds
anver
if helped mark points
‎2006 Sep 18 11:05 AM
Hi,
create lock objects for table in se11 and call
function.
CALL FUNCTION 'ENQUEUE_EZ_ZSDCFRT'
EXPORTING
MODE_ZSDCFRT = 'E'
MANDT = SY-MANDT
ZORGZIP = L_ORGZIP
ZDESZIP = L_DESZIP
ZLAND1 = L_LAND1
ZEFFDTE =
X_ZORGZIP = ' '
X_ZDESZIP = ' '
X_ZLAND1 = ' '
X_ZEFFDTE = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
CALL FUNCTION 'DEQUEUE_EZ_ZSDCFRT'
EXPORTING
MODE_ZSDCFRT = 'E'
MANDT = SY-MANDT
ZORGZIP = P_ORGZIP
ZDESZIP = P_DESZIP
ZLAND1 = COUNTRY
ZEFFDTE =
X_ZORGZIP = ' '
X_ZDESZIP = ' '
X_ZLAND1 = ' '
X_ZEFFDTE = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
EXCEPTIONS
OTHERS = 1.
Regards
amole