‎2009 May 14 10:50 AM
Hi all,
I am trying to lock a table using the following in program A. This program A will call program B. I want to unlock in program B. But I noticed that it is not possible. Why is that so? Any way to let it release in program B?
CALL FUNCTION 'ENQUEUE_E_TABLEE'
EXPORTING
MODE_RSTABLE = 'E'
TABNAME = 'ZMM_DEPRP'
VARKEY = GV_KEY
_SCOPE = '1'
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
call function 'DEQUEUE_E_TABLEE'
exporting
mode_rstable = 'E'
tabname = 'ZMM_DEPRP'
varkey = gv_key
.
‎2009 May 14 11:07 AM
Hi,
use the function module ENQUE_DELETE. To delete lock entries.
But exercise caution, Delete only those entries which you have created. Deleting others may lead to data inconsistency in system.
Thanks,
Mathivanan.G
‎2009 May 14 10:59 AM
Hi Janet,
I think once the execution of program A is completed the table is automatically Unlocked.
Regards,
Lakshman.
‎2009 May 14 11:02 AM
i think even if u dont unlock the table..once the particluar session is completed it will get unlocked..
‎2009 May 14 11:07 AM
Hi,
use the function module ENQUE_DELETE. To delete lock entries.
But exercise caution, Delete only those entries which you have created. Deleting others may lead to data inconsistency in system.
Thanks,
Mathivanan.G
‎2009 May 14 1:38 PM
Hi,
To clarify further, program A will lock a table T and then call program B. In program B, after it satisfy some conditions, it will unlock the table T at that point and pass back the control to program A. The program will not end yet, but we need the table to be unlocked.
The above is the logic of our program. It is correct that the table remains lock even when it reach program B. However when it satisfy the conditions, it is supposed to unlock it (using DEQUEUE function). Why is it not able to unlock? Is it because of different programs? Any solutions?
Thanks Mathivanan G., I will try it out to see if it works. However I still prefer if can be done by the DEQUEUE function.
‎2009 May 14 1:44 PM
it depends how you are calling the program.... are you using submit report or you are calling it with the transaction..
Regards,
Siddarth
‎2009 May 14 1:52 PM
Couldn't program A unlock the table just before calling program B, which would lock it again right away if necessary? This would be "cleaner" programming, and I don't think another process would slip in with a lock during these few microseconds.
Thomas
‎2009 May 15 1:33 AM
Hi Siddarth,
We are using SUBMIT.
Hi Thomas,
No, we have to unlock at the called program. That is how the program is design initially, therefore it will be difficult to change it. We want to make the change as simple as possible as it is a complex program.
‎2009 May 15 2:09 AM
Hi Mathivanan G.,
I managed to delete the lock using the function you have suggested. I used FM ENQUE_READ to read the lock first and pass the same parameter to ENQUE_DELETE. Thanks.
However out of curiosity, does anyone know why is it not able to use the DEQUEUE FM to unlock in another program?