‎2006 Feb 16 5:35 PM
Hi all,
Can anyone please answer me these quoestions :
1) Do we ever create lock objects to standard tables?
2) What exactly is the advantage of going to lock objects?
3) While creating lock objects what do we need to specify in the lock parameter tab ?
4) How do I use enqueue and dequeue functions in the se38 program to lock and unlock ztable.
If posible please forward me a sample program using these FM's.
Regards,
Varun.
‎2006 Feb 16 5:41 PM
Hi Varun,
You can create lock object for standard tebles also,
Pleae go through this sap help .
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm">Lock Objects</a>
Lanka
‎2006 Feb 16 5:41 PM
Hi Varun,
You can create lock object for standard tebles also,
Pleae go through this sap help .
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm">Lock Objects</a>
Lanka
‎2006 Feb 16 5:50 PM
Yes, you should always create lock object when updating a table. This ensures that your data is consistant.
Here is a sampel where I'm locking the record for finish date and plant, updating, and unlocking the record.
data: xzcposeqnr type zcposeqnr.
data: numeric_value(4) type n.
clear p_seqnr.
* Apply lock to sequence control table
call function 'ENQUEUE_EZCPOSEQNR'
exporting
mode_zcposeqnr = 'E'
mandt = sy-mandt
pedtr = p_pedtr
pwwrk = p_pwwrk
_wait = 'X'.
clear xzcposeqnr.
select single * from zcposeqnr into xzcposeqnr
where pedtr = p_pedtr
and pwwrk = p_pwwrk.
if sy-subrc = 0.
numeric_value = xzcposeqnr-seqnr + 1.
xzcposeqnr-seqnr = numeric_value.
modify zcposeqnr from xzcposeqnr.
endif.
* Unlock table entry
call function 'DEQUEUE_EZCPOSEQNR'
exporting
mode_zcposeqnr = 'E'
mandt = sy-mandt
pedtr = p_pedtr
pwwrk = p_pwwrk.
Regards,
Rich Heilman
‎2006 Feb 16 5:52 PM
‎2006 Feb 16 5:58 PM
Hi All,
I created a Ztable named zvlfa1. the fields are mandt,lifnr,name1,region,land,amount. I inserted some data also in to the table.Now in se11 I created a lock object named ezlock. In the primary table I have specified it as zvlfa1 and lock mode as exclusive,not cumulative.
In an se38 program I have the following code.
REPORT ZLOCK_PROGRAM.
CALL FUNCTION 'ENQUEUE_EZLOCK'
EXPORTING
MODE_ZVLFA1 = 'X'
MANDT = SY-MANDT
LIFNR = '234567'
X_LIFNR = ' '
_SCOPE = '2'
_WAIT = 'X'
_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.
CALL FUNCTION 'DEQUEUE_EZLOCK'
EXPORTING
MODE_ZVLFA1 = 'X'
MANDT = SY-MANDT
LIFNR = '234567'
X_LIFNR = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
.
After I execute the program and go to se12 and select the value lifnr = 234567 and say display it gives me a short dump.Probably what could be the error ? Also one more thing when we do data transefr using call transaction or session method we do not lock standard tables then why should we lock when updating using a program ?
<b>the short dump says screen not found.</b>
Regards,
varun.
Message was edited by: varun sonu
‎2006 Feb 16 6:11 PM
HI all,
Forget about my previous query. Say If I lock a record using enqueue FM before I update that, Is there any way to ckeck that it has been locked ? How do I know That it has been locked ?
Regards,
Varun.
‎2006 Feb 16 6:19 PM