Application Development 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: 

Regarding the use of lock object Dequeue

phoenixming0912
Advisor
Advisor
0 Kudos

Hi experts,

I have a use case to update multi tables with enqueue and dequeue lock object.

Usually, the code sequence is like Enqueue->Update->Dequeue, but if the exception should be taken into consideration, for example, the code was like below:

CALL FUNCTION 'ENQUEUE'.
TRY.
CALL METHOD zcl_aaa=>maint_mult( ).
CATCH /cx/excp.
RAISE error_update.
ENDTRY.
CALL FUNCTION 'DEQUEUE'.

I think if "error_update" was raised, the Dequeue function could be missed, so I think may be "DEQUEUE" function also needs to be called before "error_update" was raised.

I am wondering if there is a better way.

Regards,
Eric

1 REPLY 1

Sandra_Rossi
Active Contributor
0 Kudos

It's not that difficult to dequeue the locks whatever happens. You may use one method to dequeue, you have CLEANUP, etc.

If you use ROLLBACK WORK, it dequeues all scope 2 locks.

COMMIT WORK also takes care of the locks.

In other cases, you may either dequeue explicitly, or dequeue all with function module DEQUEUE_ALL.

See the ABAP documentation for more information.

NB: you should use the old form of RAISE only if you're implementing code inside existing code which requires the use of the old form.