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

commit work and enqueue and dequeue

Former Member
0 Likes
3,410

Hi all,

Please help.

My program logic is as follows:

(1) enqueue pernr

(2) update infotypes for the pernr

(3) dequeue pernr

(4) commit work and clear buffer

(5) enqueue pernr

(6) additional logic

(7) dequeue pernr

(8) commit work and clear buffer

I have to perform to commit due to certain design requirements.

When i am performing the ENQUEUE action again at (5), i will get an error that the pernr cannot be locked. This error is not consistent, sometimes it happens, sometimes it doesn't.

Can anyone help me on this?

Regards,

Ming

3 REPLIES 3
Read only

Former Member
0 Likes
1,344

Please try a COMMIT WORK AND WAIT. With a COMMIT WORK, the program will continue to be executed even though the commit may not of finished.

Also try putting it into debug mode and check SM12 for the table locks to see if they have been removed.

Read only

Former Member
0 Likes
1,344

A lot of times there is a delay in the lock being released and how fast the program is running. This is what I typically do for the second enqeue. Put a do loop around it:

do x times.

enqueue pernr.

if sy-subrc = 0.

exit.

endif

enddo.

You can experiment with the number of times. Just set this so you don't end up in an endless loop.

Chris H.

Read only

Former Member
0 Likes
1,344

At (5) set _WAIT = 'X' for the ENQUEUE function.

Rob