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: 

Dequeue function does not work in RFC call (using Starting New Task syntax)

Former Member
0 Kudos

Hi All,

Here's the issue:

I'm locking a bunch of sales orders in my program and submitting to a program for processing the sales orders (changing header/item data). The called program in turn calls an RFC (Z function module that calls standard BAPI for sales order change). The RFC is called using 'Starting New Task' (Parallel processing framework). Inside the Z function module, when the orders are changed one at a time in a loop, I need to unlock the sales order (using the DEQUEUE_EVVBAKE function). This function returns a sy-subrc = 0, but the unlocking does not happen.

Thanks in advance.

Please help.

1 ACCEPTED SOLUTION

former_member589029
Active Contributor
0 Kudos

The enqueue/dequeue functions work only within the same LUW.

You create the lock in the initial program, the locks are held as long as this program runs (or you release the locks in that program).

Since you call the RFC with starting new task a new LUW is opened and any dequeue statement will not release the locks, because they were never created in that LUW.

You have two options:

Either try to find a logic to trigger the release of the locks in the main program or if that doesn't work, set the lock in the RFC itself, that way you are in the same LUW and can release them later again.

Hope that explains it.

Michael

2 REPLIES 2

former_member589029
Active Contributor
0 Kudos

The enqueue/dequeue functions work only within the same LUW.

You create the lock in the initial program, the locks are held as long as this program runs (or you release the locks in that program).

Since you call the RFC with starting new task a new LUW is opened and any dequeue statement will not release the locks, because they were never created in that LUW.

You have two options:

Either try to find a logic to trigger the release of the locks in the main program or if that doesn't work, set the lock in the RFC itself, that way you are in the same LUW and can release them later again.

Hope that explains it.

Michael

0 Kudos

Thanks Michael for your prompt response.

I had tried the option of locking the orders in the RFC but the BAPI was releasing all the locks, instead of releasing the lock on just the order changed.

I then figured the parameter _SCOPE in the Enqueue and Dequeue functions. Setting the value = 1 for this parameter worked for me.

Regards,

Shyam