Hi all.
I have the following situation.
When the customer posts a Purchase Receipt, he need to create and post a Transfer Order for each line of the Receipt.
I tried inserting the following code in C90 for each line.
CODEUNIT.RUN(CODEUNIT::"TransferOrder-Post Shipment", TransferHeader);
CODEUNIT.RUN(CODEUNIT::"TransferOrder-Post Receipt", TransferHeader);
I also tried the following:
TransferPostShipment.RUN(TransferHeader);
TransferPostReceipt.RUN(TransferHeader);
However, if there is an error while posting the Transfer Order, I get an error message but the Purchase Receipt gets posted.
I tried using the return value of the CODEUNIT.RUN, but I get a message saying that write transactions are not allowed.
How can I call the Transfer Post, so that if an error occurs, the whole procedure gets rolled back?
Thanx
Jorgito
Answers
http://www.mibuso.com/forum/viewtopic.php?t=10025
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Thanx for the solution.
It seems that Navision does not let you run a codeunit that performs a commit, while you are inside a transaction.
The way to solve this problem is:
In C5704 (TransferOrder-Post Shipment) and C5705 (TransferOrder-Post Receipt):
- Create a Boolean variable : - Create a function
- Change all COMMITs to
and finaly you can run the codeunit using
Jorge
You can run a codeunit with a commit while already inside a transaction. The problem is that with the commit in the codeunit, the transaction is commited.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!