2007 Dec 10 8:17 PM
Hi Friends,
I have a Zprogram, in which initially using BAPI - BAPI_SALESORDER_CHANGE I will be updating the sale order. After this I have given COMMIT WORK and Wait statement for updates to be done. Later after updating the sale order, next step in my program is to create a delivery. For creating delivery I am using FM RV_DELIVERY_CREATE. Here it is erroring out with Message Id VI with Message Number 200. If I execute after some time the program, it is working fine and creating delivery. Only for the first time it is giving error. Please can anyone give me some ideas to rectify the error. Your answers will be awarded & appreciated
Thanks
Vinod
2007 Dec 10 8:33 PM
2007 Dec 10 8:37 PM
after first BAPI, call BAPI FM: BAPI_TRANSACTION_COMMIT , instead of just commit work.
delete the wait statement , check it, if it is ok then no problem
other wise put a wait statement with 2 seconds.
2007 Dec 10 8:44 PM
Hi,
I beleive when using BAPI_SALESORDER_CHANGE, it is locking the Sale Order. After the execution of the FM BAPI_SALESORDER_CHANGE, I can still see the the sale order & item in SM12 tcode with Lock mode "E". So I need to unlock the Sale Order after the execution of FM BAPI_SALESORDER_CHANGE and Commit work and wait statement. Please can anyone give ideas to unlock the Sale Order after the execution of FM BAPI_SALESORDER_CHANGE & commit statement.
Thanks
Vinod
2007 Dec 10 8:55 PM
Do not unlock the enqueue objects, you will run into bigger issues, use BAPI_TRANSACITON_COMMIT with WAIT = 'X'. Alternatively, you can introduce a DO loop around your delivery create call and exit the DO loop as soon as the creation is successful. Make sure that you check for only the lock error message to determine if you should continue in the DO loop or exit.
DO.
CALL create delivery function module.
IF sy-index = 10.
*-- get out of this loop if even after 10 loops, the lock still exists
EXIT.
ELSEIF sy-msgid = '??' AND sy-msgno = '???'.
*-- there is a lock on this sales order
CONTINUE.
ELSE.
EXIT.
ENDIF.
ENDDO.
2007 Dec 10 9:20 PM
2007 Dec 10 10:14 PM
No you should not. It will create unwanted results. Please do as I suggested, it works.
2007 Dec 10 10:27 PM
Hi,
I did used BAPI - BAPI_TRANSACTION_COMMIT & WAIT = 'x'. but still after that statement, SO is still locked. I need SO to be unlocked before creating the delivery.
Please suggest ideas
Thanks
Vinod
2007 Dec 10 10:30 PM
2007 Dec 10 10:39 PM
Hi Rob,
I am not passing return table, here is the code how I am passing
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IMPORTING
RETURN =
Thanks
Vinod
2007 Dec 10 10:53 PM
My requirement is once after executing BAPI,BAPI_SALESORDER_CHANGE &
BAPI_TRANSACTION_COMMIT. I should not see my Sale Order in lock enteries SM12 Tcode. But I am doing so. So please suggest me some ideas to unlock the Sale Order immediatly after executing BAPI,BAPI_SALESORDER_CHANGE &
BAPI_TRANSACTION_COMMIT.
Thanks
Vinod
2007 Dec 11 3:18 AM
Pass the return parameter and check it. There may be nothing there, but until you check it, you won't know for sure.
Rob
2007 Dec 11 12:19 AM
You have to DEQUEUE. But make sure you call calling the BAPI_TRANSACTION_COMMIT with wait = 'X'.
Albert
2010 Jan 22 4:24 AM
Hi Vinod,
I also want to create an outbound delivery using that FM. So could u post the sample code to call the FM RV_DELIVERY_CREATE. I wanna know how to populate the parameters.
Regards
Vindika