Hi all, i have created a codeunit which generates Purchase Orders. The informaiton of the Orders is read form a table.
The problem is that, if the first record of the table can not generate an order for some reason the codeunit stops its execution and does not generate the rest of the Orders.
I try to put a COMMIT after the generation but this line is never read, the error finish the execution before.
IF g_recVenInvNo.FIND('-') THEN
REPEAT
BEGIN
f_CreateOrder();
COMMIT;
END
UNTIL g_recVenInvNo.NEXT = 0;
How can I do to generate the rest of the documents.
Thanks
Comments
my execution program finish because function f_CreateOrder fails. I can not continue asking.
It is not working when calling another function in the codeunit. The OnRun trigger of the codeunit must be used. In this case, when there is some error during the execution, the "else" branch of the if-then will be called and you can do it in a loop for every record you want. If you are in NAV 5.00 you can use the GetLastError command to read the error text and you can e.g. store it in your source table...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Regards