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

Dequeue for lock entry

Former Member
0 Likes
3,539

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,590

Could we see your code please?

Rob

10 REPLIES 10
Read only

roland_spindler
Participant
0 Likes
2,590

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

Read only

Former Member
0 Likes
2,591

Could we see your code please?

Rob

Read only

0 Likes
2,590

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

Read only

0 Likes
2,590

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.

Read only

0 Likes
2,590

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

Read only

0 Likes
2,590

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.

Read only

0 Likes
2,590

Try deleting the locks using SM12 and then rerun the code. If sy-subrc = 0, it should be unlocked.

rob

Read only

0 Likes
2,590

Hi Rob,

its running fine now, (though I´m not quite sure why since nothing was changed).

Thanks for the tips.

Read only

0 Likes
2,590

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

Read only

venkata_ramisetti
Active Contributor
0 Likes
2,590

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