IF ErrorHandlingG = ErrorHandlingG::"Skip error" THEN BEGIN IF NOT CallUpdateItemG.RUN(Item) THEN BEGIN IsErrorG := TRUE; ControlPanelTempG."No. of Errors" := ControlPanelTempG."No. of Errors" + 1; CurrReport.SKIP; END; END ELSE CallUpdateItemG.RUN(Item);When I run rhis report from Object Designer it works just fine if ErrorHandlingG = "Skip error" or "Break on error". When I run this report from another form (Job Batch) and ErrorHandlingG = "Break on error" it also works fine. When ErrorHandlingG = "Skip error" I got this error message:
I know I can put COMMIT before running CallUpdateItemG codeunit, I tried it and it works. But it doesn't fit me. I want to understand, whyThe following C/AL functions can be used only to a limited degree during write transactions (because one or more tables will be locked).
Report.RunModal() is allowed in write transactions only if 'RequestForm = FALSE'. For example, 'Report.RunModal(...,FALSE)' is allowed
Answers
In NAV there is at most one write transaction.
If NAV allowed your 2nd codeunit.RUN it needed to start a 2nd, nested, transaction just before the call in order to roll back to this point in case something goes wrong within that 2nd RUN. The first call to codeunit.RUN (within Job Queue Dispatcher) could still succeed and therefore should not be rolled back. This is only possible with nested write transactions and therefore, this situation cannot be handled by NAV.
Thanks!