An attempt was made to change an old version of a transfer header record in dynamics nav 2015

Hello Everyone,

I add two fields in Posted Transfer Shipment table Total Quantity and amount by using calcfield on Transfer Shipment Line table. To calculate amount against each item i use code and insert in Amount Field and modify that field. It work fine but is that when i create new transfer order i display error message "An attempt was made to change an old version of a transfer header record. The record should be reread from the database."

This code i use to modify amount field.

TransShpLine.RESET;
TransShpLine.SETAUTOCALCFIELDS(TransShpLine.ItemAmount);
TransShpLine.SETRANGE(TransShpLine.Calculated,FALSE);

IF TransShpLine.FINDSET THEN REPEAT
TransShpLine."Document No." := TransShpLine."Document No.";
TransShpLine."Line No." := TransShpLine."Line No.";
TransShpLine.Amount := (TransShpLine.Quantity * TransShpLine.ItemAmount);
TransShpLine.Calculated := TRUE;
TransShpLine.MODIFY;
UNTIL TransShpLine.NEXT = 0;
MESSAGE('Done');

Best Answer

  • MubasherMubasher Member Posts: 25
    Answer ✓
    TransShpLine."Document No." := TransShpLine."Document No.";
    TransShpLine."Line No." := TransShpLine."Line No.";

    No need for these lines.
    Code is working fine by removing these line.

Answers

  • MubasherMubasher Member Posts: 25
    Answer ✓
    TransShpLine."Document No." := TransShpLine."Document No.";
    TransShpLine."Line No." := TransShpLine."Line No.";

    No need for these lines.
    Code is working fine by removing these line.
Sign In or Register to comment.