2011 Mar 08 4:45 PM
Hello,
We are creating calling Asynchronous function module in the Delivery User Exist to create Invoice. Invoice creation needs to wait until delivery change is commited. For this purpose, we have placed ENQUEUE_SLEEP FM in the asynchronous FM with a wait time of 1 second. We have written a logic in such a way that ENQUEUE_SLEEP is called in a loop causing a delay of one second until delivery can be locked successfully.
But we cant let it wait for one second. Delivery should be locked as soon as delivery is committed in the main program. How can we achieve this in asynchronously called FM.
Thanks
2011 Mar 08 6:52 PM
Invoice creation needs to wait until delivery change is commited. For this purpose, we have placed ENQUEUE_SLEEP FM in the asynchronous FM with a wait time of 1 second. We have written a logic in such a way that ENQUEUE_SLEEP is called in a loop causing a delay of one second
Why are you going for this approach ? You can create a remote enabled fm and call it in background task as seperate unit in your user exit..
2011 Mar 09 3:59 AM
I am following the exact approach of calling remote enabled FM in background task in seperate unit to create invoice. But This FM has to wait till delivery is committed. For this purpose, I am continuously trying to lock delivery after making it wait for 1 second.
But sometimes this 1 second is long enough for user to open the delivery in change mode again. I want to lock delivery as soon as delivery change has been committed. How can I do it?
2011 Mar 09 4:27 AM
>
> I am following the exact approach of calling remote enabled FM in background task in seperate unit to create invoice.
Bear in mind that asynch RFC(aRFC) & RFC as BACKGROUND TASK(transactional RFC or tRFC) are completely different. While the former is generally used for parallel processing, the latter is used to maintain the "atomicity" of an SAP LUW.
tRFC calls are registered in special DB tables(ARFCSSTATE & ARFCSDATA) & are executed once the COMMIT WORK statement is executed in the particular LUW.
Further read available on the F1 help.
BR,
Suhas