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

User lock error in BAPI_GOODSMVT_CREATE

Former Member
0 Likes
2,235

Hi,

I am using the 'BAPI_GOODSMVT_CREATE' in a program to create GR for the production orders. The user would actually execute the program, go back and execute the program again to do the GR for the same order. This may be done in several iterations. The problem is that we are getting an error message 'Order locked by user XXXXX' after the first iteration. Because of this the GR doesn't happen properly for the orders.

Please let me if know how this lock error could be removed. I have used 'WAIT = X' parameter and WAIT UPTO 4 SECONDS and have used 'DEQUEUE_ESORDER' BAPI call also to remove the locks.

PS: The BAPI call is not inside a loop.

Thanks,
Pranil

6 REPLIES 6
Read only

Former Member
0 Likes
1,214

Hi Pranil,

After successful BAPI Commit, Please use the FM CO_RU_DEQUEUE_ALL or CO_RU_ORDER_DEQUEUE to remove lock enforced on the Production order.

Hope this would help you. Thanks

Regards

Balaji R

Read only

0 Likes
1,214

Hi Balaji,

The problem persists even after using the FMs suggested by you.

Thanks,
Pranil

Read only

koolspy_ultimate
Active Contributor
0 Likes
1,214

You must De queue after commit.

Here is the ref Code

* Call goods movement BAPI

call function 'BAPI_GOODSMVT_CREATE'

     exporting

          goodsmvt_header  = gm_header

          goodsmvt_code    = gm_code

     importing

          goodsmvt_headret = gm_headret

          materialdocument = gm_retmtd

     tables

          goodsmvt_item    = gm_item

          return           = gm_return.

if not gm_retmtd is initial.

<b>  commit work and wait.

  call function 'DEQUEUE_ALL'.</b>

  write:/ gm_retmtd.

else.

  commit work and wait.

  call function 'DEQUEUE_ALL'.

endif.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,214

When the transaction end's the lock gets released. Try coming out of the program session then again try executing it.

Thanks to Suhas for sharing this point.

Read only

0 Likes
1,214

It actually works if each execution is done in a new session. But the problem is that the user wouldn't go to the transaction (which was created for the program) or go to a new session each time for the execution.

Thanks,

Pranil

Read only

Former Member
0 Likes
1,214

Hi,

Try CALL FUNCTION 'BAPI_GOODSMVT_CREATE' IN BACKGROUND TASK AS SEPARATE UNIT.

Regards,

Felipe