01-04-2006 4:19 PM
Hello,
I don´t quite understand the concept of locking customer tables. I created a lock object for table 'Ztable' and in my program use the enqueue function module to lock the table. Then i make some checks. If checks are wrong, I want to unlock the table using dequeue function module but this doesn´t work. The lock entry can still be seen via transaction SM12 for table Ztable.
Anybody know what I´m missing?
Thank you
01-04-2006 4:24 PM
01-04-2006 4:23 PM
Check if you locked the table multiple times (cumulative lock). Unlocking the table once will only decrease the cumulation counter.
That's a common error on dequeue.
best regards
Roland
01-04-2006 4:24 PM
01-04-2006 4:30 PM
A couple of further points:
Normally an object is only locked while it (and other objects in the LUW) are being updated. IE.
Lock
Update
Unlock
Additionally, you don't always have to lock the entire table. You can lock just those rows that are affected.
Rob
01-04-2006 4:47 PM
Thanks for the replies ...
The lock object is exclusive, not cumulative.
Here´s the simple code.
locking...
CALL FUNCTION 'ENQUEUE_EZZGRBW_OHUBLOCK'
EXPORTING
infospoke = g_infospoke
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
unlocking ...
CALL FUNCTION 'DEQUEUE_EZZGRBW_OHUBLOCK'
EXPORTING
infospoke = g_infospoke.
where g_infospoke is a variable for infospoke name.
I need to ensure that the infospoke is being
read only once at a time. Once its finished transferring data, i wanted to unlock the entry in the lock table.
I also wanted to allow an administrator (ie. another user) to use the 'Dequeue...' function module to unlock the lock object if it were to hang for some reason.
01-04-2006 4:57 PM
What is the value of sy-subrc after the dequeue?
Why do you want the administrators to use the FM? Can't they use SM12?
Rob
Message was edited by: Rob Burbank
01-04-2006 5:08 PM
Hello Rob,
SY-SUBRC = 0 but the entry still appears in SM12 for the table.
Yes, the administrator could use SM12 to delete the entry but they the colleagues want a special button to do this from the GUI.
01-04-2006 5:24 PM
Try deleting the locks using SM12 and then rerun the code. If sy-subrc = 0, it should be unlocked.
rob
01-04-2006 6:08 PM
Hi Rob,
its running fine now, (though I´m not quite sure why since nothing was changed).
Thanks for the tips.
01-04-2006 6:15 PM
I think it's possible that the lock entry you saw was old and deleting it just put everything back where it should be.
Glad to help.
Rob
01-04-2006 4:24 PM
Hi
It should work...
Probably you are not sending the same locked data to DEQUEUE FM.
Check the below sample code:
call function 'ENQUEUE_EZ_ZMARA'
exporting
MATNR = I_MATNR
WERKS = I_WERKS
exceptions
foreign_lock = 1
system_failure = 2
others = 3.
call function 'DEQUEUE_EZ_ZMARA'
exporting
MATNR = i_MATNR
WERKS = I_WERKS.
Thanks,
Ramakrishna