2012 May 31 11:13 AM
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.
2012 Jun 01 9:57 AM
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.
2012 May 31 1:35 PM
2012 May 31 1:50 PM
2012 May 31 2:32 PM
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?
2012 May 31 4:11 PM
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
2012 Jun 01 9:57 AM
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.