‎2007 Sep 01 2:52 AM
Hi,
I created lock object "ez_z001" for the table "z001", called
function module "enqueue_ez_z001" to lock the record, and the
the return code sy-subrc = 0, but I still can edit the record in another
session/program.
Please kindly advise what the problem is.
Thanks and best regards.
‎2007 Sep 01 3:01 AM
How you are calling FM ?
CALL FUNCTION 'ENQUEUE_EMPLAFE'
EXPORTING
plnum = i_plaf-plnum -> Give your ztable field
<b> _scope = '3'</b>
EXCEPTIONS
foreign_lock = 2
system_failure = 3.
See the above FM ,How i am calling
Unlock
CALL FUNCTION 'DEQUEUE_EMPLAFE'
EXPORTING
plnum = i_plaf-plnum. -> give ztable field here
Thanks
Seshu
‎2007 Sep 01 3:01 AM
How you are calling FM ?
CALL FUNCTION 'ENQUEUE_EMPLAFE'
EXPORTING
plnum = i_plaf-plnum -> Give your ztable field
<b> _scope = '3'</b>
EXCEPTIONS
foreign_lock = 2
system_failure = 3.
See the above FM ,How i am calling
Unlock
CALL FUNCTION 'DEQUEUE_EMPLAFE'
EXPORTING
plnum = i_plaf-plnum. -> give ztable field here
Thanks
Seshu
‎2007 Sep 01 3:06 AM
Hi, Seshu ,
Thank you very much for the answer.
I called the FM as follows:
data: wk_prno like Z001-prno.
wk_prno = '1000000001'.
CALL FUNCTION 'ENQUEUE_EZ_Z001'
EXPORTING
mode_Z001 = 'E'
mandt = sy-mandt
prno = wk_prno
X_PRNO = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3
Please kindly advise again.
Thanks and best regards.
‎2007 Sep 01 3:24 AM
You welcome tt.
data: wk_prno like Z001-prno.
wk_prno = '1000000001'.
Locking
CALL FUNCTION 'ENQUEUE_EZ_Z001'
EXPORTING
*mode_Z001 = 'E'
*mandt = sy-mandt
prno = wk_prno
X_PRNO = ' '
_SCOPE = '3'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3
.
Unlocking
CALL FUNCTION 'DEQUEUE_EZ_Z001''
EXPORTING
prno = wk_prno.
Good luck
Thanks
Seshu
‎2007 Sep 01 3:30 AM
Hi, Seshu,
Thank you very much for your answer.
I tried according to your advise. But It didn't work. After the return code sy-subrc = 0, I still can edit the record via tcode SE16.
Please kindly advise again.
Thanks and best regards.
‎2007 Sep 01 5:33 AM
hello tt,
You did not mention table record at SE16 ,It is not possible to keep locking at record level in SE16 Transaction but you can keep locking record at transaction level ( if you have dialog program)
otherway you can lock complete table if you use below
Lock FM - 'ENQUEUE_E_TABLE'
Unlock FM - 'DEQUEUE_E_TABLE'
Here i am using ZTEST99 Table and i am able to lock complete table
REPORT ZSAI1.
tables : ztest99.
start-of-selection.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = 'E'
TABNAME = 'ZTEST99'
VARKEY =
X_TABNAME = ' '
X_VARKEY = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
break sy-uname.
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = 'E'
TABNAME = 'ZTEST99'
VARKEY =
X_TABNAME = ' '
X_VARKEY = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
.
Thanks
Seshu
‎2007 Sep 01 5:37 AM
Hi, Seshu,
Thank you very much for your expertise.
The problem was solved according to your advise.
Thanks and best regards.