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: 

Process Order Lock Problem

former_member189779
Active Contributor
0 Kudos

I am using BAPI_PROCORDCONF_CREATE_TE to confirm the operation/phase of process order. Then I do BAPI_TRANSACTION_COMMIT and Wait = X

as well.

Once confirmed Then I am using BAPI_PROCORD_SETUSERSTATUS to set the user status to next opeartion.

        call function 'BAPI_PROCORD_SETUSERSTATUS'

          exporting

            status_profile     = lw_stsma

            status             = lw_stand

         tables

            orders             = li_aufnr

            detail_return      = li_detail_return.

I am not using parameter work_process_group for above BAPI as we do not have server group COWORK_BAPI set up and I do not want parallel processing.

When I do so I am getting message "Order is locked". When I check in debug it works. I also tried putting commit work and wait before calling set user status BAPI as written in documentation of BAPI. but no luck. When I put wait upto 20 seconds before calling BAPI it works but is is not the solution.

What is causing Order to get locked? becuse of this it is behaving randomly some times works some times not.

1 ACCEPTED SOLUTION

former_member189779
Active Contributor
0 Kudos

The problem was lock was getting created inside 'BAPI_PROCORD_SETUSERSTATUS' . I created the Y FM and called it in background task and cheked for the lock in loop.

5 REPLIES 5

former_member189779
Active Contributor
0 Kudos

Any thoughts on this?

raymond_giuseppi
Active Contributor
0 Kudos

There can be (sometimes, often) a delay between end of update task and actual update of database, easiest way is to try to lock yourself the record, with _wait parameter set.

Regards,

Raymond

0 Kudos

easiest way is to try to lock yourself the record, with _wait parameter set.

Do you mean create lock object for Order? What do you mean by wait parameter set?

0 Kudos

Hi,

no creation of any object needed.

Use SM12 to find out which lock is set when order is processed - you make set a break point in the before COMMIT WORK to see all active locks.

Probably Calls to

FUNCTION 'ENQUEUE_EPROOB'

ENQUEUE_ECOWIPB_CHVW

will return SY-SUBRC not zero as long as the lock ist active.

Do this in a loop after COMMIT WORK until SY-SUBRC = 0 and then call the corresponding DEQUEUE_ function, then continue.

Hope you can find out the values for parameters of ENQUEUE_ functions.

Regards,

Clemens

former_member189779
Active Contributor
0 Kudos

The problem was lock was getting created inside 'BAPI_PROCORD_SETUSERSTATUS' . I created the Y FM and called it in background task and cheked for the lock in loop.