‎2008 May 19 9:31 AM
i have created a database table, now i have created a program
with this code
CALL FUNCTION 'ENQUEUE_EZLOCK3'
EXPORTING
MODE_ZINT_TAB5 = 'E'
A = 'manu'
X_A = ' '
_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.
the record with A field manu shud have been locked
but during debugging(stopping after execution of this FM)
i edited this record from se11.
it allowed me to do
but it shud not have allowed as the program i am executing has a lock on that entry
please help
‎2008 May 19 9:39 AM
hi,
try givin manu in caps 'MANU'.
and also check the example function module
MODULE enqueue INPUT.
CASE ok_code.
WHEN 'ENQUEUE'.
CALL FUNCTION 'ENQUEUE_EDEMOFLHT'
EXPORTING
mode_sflight = 'X'
carrid = sflight-carrid
connid = sflight-connid
fldate = sflight-fldate
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
CASE sy-subrc.
WHEN 0.
MESSAGE i888 WITH 'Enqueue successful'(001).
WHEN 1.
text = sy-msgv1.
MESSAGE e888 WITH 'Record already'(002) 'locked by'(003)
text.
CALL TRANSACTION 'SM12'.
WHEN 2 OR 3.
MESSAGE e888 WITH 'Error in enqueue!'(004)
'SY-SUBRC:' sy-subrc.
ENDCASE.
regards
prasanth
‎2008 May 19 9:45 AM
‎2008 May 19 1:06 PM
i think the only problemwith ur code cud b wronmg position of breakpoint..
put breakpoint just after this function module and before dequeue..
then the object will get locked..
the example ion which i worked is shown below.
CALL FUNCTION 'ENQUEUE_EZ98442EMPL'
EXPORTING
MODE_Z98442EMPL = 'E'
MANDT = SY-MANDT
EMPID = EMPID
X_EMPID = ' '
_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.
please reward if u find this useful..
thanks and regards
palak
‎2008 May 19 1:34 PM
Hi Manu,
The problem might be due to the client field(MANDT) which you have not included in the lock object, it is mandatory to be included in the table as well in the lock object. Try to add it to the table and lock object, check it again.
Regards,
Muthu.
‎2008 May 20 11:09 AM
Hi manu
Minimum fields required to maintain in the FM are: MODE, MANDT and fields.
Check the below code which may help youu2026
To lock the table records VEPO.
CALL FUNCTION 'ENQUEUE_EZ_VEPOZZMDV01'
EXPORTING
mode_vepo = lc_e
mandt = sy-mandt
venum = gwa_vepo-venum
vepos = gwa_vepo-vepos.
Updating the database table VEPO for the field ZZMDV01 based on the fields
VENUM and VEPOS and updating with the screen filed value MDV01 (Production Line).
UPDATE vepo SET zzmdv01 = gv_mdv01
WHERE venum = gwa_vepo-venum
AND vepos = gwa_vepo-vepos.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF. " IF sy-subrc = 0.
To unlock the table records VEPO.
CALL FUNCTION 'DEQUEUE_EZ_VEPOZZMDV01'
EXPORTING
mode_vepo = lc_e
mandt = sy-mandt
venum = gwa_vepo-venum
vepos = gwa_vepo-vepos.
ENDLOOP. " LOOP AT gi_vepo INTO gwa_vepo.
So try to check the table records after the ENQUEUE Function module and try to maintain the Client field MANDT in the FM.
‎2008 May 22 7:30 AM
Hi,
Query is you r able edit the entries in se11,after calling the Lock FM.Which it should..(Data base Lock is different as it will be taken care by the system)
1)Call another session execute the same program and test it by editing the same field the lock would have been enabled.
Objective of the lock FM is to restrict users using paralleling the same program,and trying to edit the same record.
Regards,
Mukundan.R