Error when trying to release PO in Nav 2013

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:

Document Type=‘Order’,No.=‘PSP000029##’

3583.Idean Ind 010813.jpg

I am getting the same error, did u get the solution?

Please share.

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”)

PurchLine.SetPurchHeader(Rec);
PurchLine.CalcVATAmountLines(0,Rec,PurchLine,TempVATAmountLine0);
PurchLine.CalcVATAmountLines(1,Rec,PurchLine,TempVATAmountLine1);
PurchLine.UpdateVATOnLines(0,Rec,PurchLine,TempVATAmountLine0);
PurchLine.UpdateVATOnLines(1,Rec,PurchLine,TempVATAmountLine1);

IF “No.”<> ‘PSP00029’ THEN ///// Temporary line by Abz@TecMan

MODIFY(TRUE);

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!

Hello,

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:

http://msdn.microsoft.com/en-us/library/dd355313(v=nav.70).aspx

It explains the scenario and asks to verify the existing code and then do a little modification to resolve.

Hope this helps.

Regards,

Congruent Info - Tech

Thanks Abz@TecMan for your reply…

I am getting this error for every order…I have written code…

IF No.<>’’ THEN

Modify(True);

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 ) and the SQL Server and tried releasing again?

after restarting the service, getting the same error…

Nitin

Revieweing your code


IF No.<>’’ THEN

Modify(True);


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

Modify(True);

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 )

FIND;

MODIFY(TRUE);

IF NotOnlyDropShipment THEN

IF “Document Type” IN [“Document Type”::Order,“Document Type”::“Return Order”] THEN

WhsePurchRelease.Release(Rec);

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/…/

Thanks