Error / search:
An attempt was made to change an old version of a Purchase Header record. The record should first be reread from the database. This is a programming error.
Identification fields and values:
I am getting the same error, did u get the solution?
Its very urgent for me..
Did not try to replicate this in a cronus database (didnt know how long it was going to take!)
but the work around was to add code in CU415,
FUNCTION: OnRun(VAR Rec : Record "Purchase Header")
IF "No."<> 'PSP00029' THEN ///// Temporary line by Abz@TecMan
IF NotOnlyDropShipment THEN IF "Document Type" IN ["Document Type"::Order,"Document Type"::"Return Order"] THEN WhsePurchRelease.Release(Rec);
Essentially what we are doing here is preventing NAV from writing to the record twice because for some reason it thinks it has written once already (which it probably has according to the code and what error we are getting), thus preventing the second 'modify' instruction for this particular purchase order. Purchase order is now released.
If anyone knows how to replicate it, let us know as this is the first time an error like this has appeared, Could be a new error since NAV 2013 launch!
We have not faced any issues of similar nature in our environment, but while going through few documents we found that the error might be due to upgrade activity performed.
Following is a link to an article:
It explains the scenario and asks to verify the existing code and then do a little modification to resolve.Hope this helps.
Congruent Info - Tech
Thanks Abz@TecMan for your reply..
I am getting this error for every order..I have written code..
IF No.<>'' THEN
Still getting the same error for every order No.
Please suggest some solution..I would be very thankful to you.
You've probably already tried this but in case you haven't...
Have you restarted the Middle Tier (Dynamics NAV Server <windows service>) and the SQL Server and tried releasing again?
after restarting the service, getting the same error..
Revieweing your code
You are saying if the order number is other than blank (which it is!), the modify instruction is executed which it is doing. Shouldnt the filter have been set to something like
IF No.<>'PO*' THEN
which bypasses the modify instructions for PO's. In our case we bypassed this instruction by specifying a certain PO. But in your case we dont want that, we want to primarilly bypass this instruction so the release routine is run in full. Try putting a specific PO number in there and try releasing the same PO or change the filter in your code so the modify instruction is bypassed for PO's, hence CU415 should run in full, remember to re-instate the original code!!
Why making it so difficult just use the magic five letters.
Put the function FIND; in the code (this in codeunit 415 )
IF NotOnlyDropShipment THEN
IF "Document Type" IN ["Document Type"::Order,"Document Type"::"Return Order"] THEN
Using Find in this case can actually cause problems bigger than the initial error. See here how to reproduce and explanation about the cause of this error: andreilungu.com/.../