2013 Oct 01 12:42 PM
Hello experts,
I have used the BAPI BAPI_PRODORD_CHANGE for updating the PO quantity within the Loop.
as per this BAPI's documentation, have not used the COMMIT BAPI after PO change BAPI.
after this BAPI execution, there is also CO02 BDC being used for changing the PO status within the same Loop statement.
Problem is now during the CO02 BDC execution, error comes as 'PO is being used by User_name'.basically this is the PO locking error for the same user id. This is happening only for few PO's and not for all.
please suggest me for resolving this issue.
Regards,
Jagesh
Hello experts,
I have used the BAPI BAPI_PRODORD_CHANGE for updating the PO quantity within the Loop.
as per this BAPI's documentation, have not used the COMMIT BAPI after PO change BAPI.
after this BAPI execution, there is also CO02 BDC being used for changing the PO status within the same Loop statement.
Problem is now during the CO02 BDC execution, error comes as 'PO is being used by User_name'.basically this is the PO locking error for the same user id. This is happening only for few PO's and not for all.
please suggest me for resolving this issue.
Regards,
Jagesh
2013 Oct 01 12:47 PM
Hello Jagesh.
Why using BAPI and BDC to perform two different CO02 operations?
May be you can use BDC to do both the operations OR
Try with the statements COMMIT WORK AND WAIT or WAIT UP TO N SECONDS (N-1,2..etc) before calling BDC.
Regards.
2013 Oct 01 12:53 PM
Hi,
Try passing WAIT = 'X' to the BAPI_TRANSACTION_COMMIT FM.
2013 Oct 01 1:08 PM
Hi,
I have used the seperate BDC for CO02 because PO change BAPI does not allow to change the PO status.
as per the PO CHange BAPI Documentation in SE37, we must not have to use the COMMIT BAPI after it so i havent used it.
Issue with the WAIT statement is it will put the delay in program.
Thanks for your reply.
Regards,
Jagesh
2013 Oct 02 4:27 AM
2013 Oct 02 8:47 AM
as per the PO CHange BAPI Documentation in SE37, we must not have to use the COMMIT BAPI after it so i havent used it.
Can you post your version of documentation, this is surprising...
You should (must) either
Regards,
Raymond
2013 Oct 01 1:03 PM
Sounds like the order is still locked from the bapi call. I suggest to use statement WAIT UP TO 2 SECONDS
(or 3) and see if the problem persists.
2013 Oct 01 1:33 PM
2013 Oct 02 9:15 AM
Hi Jagesh,
Even if its written in Documentation.... try with BAPI_TRANSACTION_COMMIT and pass wait = 'X'.
This may take less time than "wait for 2 or 3 seconds" statement. Then probably after execution, your BDC will not give this lock error.
Thanks,
Sumit
2013 Oct 02 9:35 AM
Hi Jagesh,
Were any of the replies helpful, or solve your issue?
2013 Oct 02 10:44 AM
Hi Anthony,
Initially i used the BAPI_TRANSACTION_COMMIT as well and then also i was getting the locking error in subsequent BDC execution.
Presently for a solution, i have used the FM ENQUEUE_ESORDER just before the CO02 BDC execution, if SY-SUBRC is not equal to 0 then i am using the WAIT UP TO 5 seconds statement and it is working fine for me so far.
Regards,
Jagesh
2013 Oct 02 11:00 AM
Initially i used the BAPI_TRANSACTION_COMMIT as well and then also i was getting the locking error in subsequent BDC execution.
Did you set the WAIT parameter ?
5 seconds is too much (imagine when a huge batch of orders is to be processed....) I would suggest set of the _wait parameter in the enqueue FM and wait only 1 seconds in a DO/ENDDO loop (or do not wait at all as the lock attempt will wait itself).
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true
IMPORTING
return = return.
* Check return table also here
DO.
CALL FUNCTION 'ENQUEUE_ESORDER'
EXPORTING
aufnr = lv_aufnr
_wait = abap_true
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0.
CALL FUNCTION 'DEQUEUE_ESORDER'
EXPORTING
aufnr = lv_aufnr.
EXIT.
ENDIF.
* WAIT UP TO 1 SECONDS.
ENDDO.You did not try to call BAPI_PRODORD_CHANGE and BAPI_PRODORD_SETUSERSTATUS before a sibngle BAPI_TRANSACTION_COMMIT ?
Regards,
Raymond
2013 Oct 02 11:52 AM
Hi,
Thanks for your reply and agree with your toughts that using the WAIT statement is going to put the 5 seconds of static delay for every locking.
i didnt use the WAIT parameter along with the COMMIT BAPI.
hence i am replacing the existing coding with the below one.
DO.
CALL FUNCTION 'ENQUEUE_ESORDER'
EXPORTING
AUFNR = P_AUFNR
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF SY-SUBRC <> 0. "Not equal to 0 means PO is found Lock here
LD_COUNTER = LD_COUNTER + 1.
CALL FUNCTION 'DEQUEUE_ESORDER' "Try to unlock the locked PO
EXPORTING
aufnr = P_AUFNR.
IF LD_COUNTER GE 5.
EXIT.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
Regards,
Jagesh
2013 Oct 02 12:56 PM
Okay, great. Just asked because i see your question is still open on the forum.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |