Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Locking and unlocking in 2 programs

Former Member
0 Likes
1,029

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

.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
899

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

8 REPLIES 8
Read only

former_member209217
Active Contributor
0 Likes
899

Hi Janet,

I think once the execution of program A is completed the table is automatically Unlocked.

Regards,

Lakshman.

Read only

former_member242255
Active Contributor
0 Likes
899

i think even if u dont unlock the table..once the particluar session is completed it will get unlocked..

Read only

Former Member
0 Likes
900

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

Read only

Former Member
0 Likes
899

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.

Read only

0 Likes
899

it depends how you are calling the program.... are you using submit report or you are calling it with the transaction..

Regards,

Siddarth

Read only

ThomasZloch
Active Contributor
0 Likes
899

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

Read only

Former Member
0 Likes
899

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.

Read only

Former Member
0 Likes
899

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?