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 it display an 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');
*This post is locked for comments
Why in the FINDSET loop you re-assign Document No and Line No with the same values?
You can remove these lines:
TransShpLine."Document No." := TransShpLine."Document No.";
TransShpLine."Line No." := TransShpLine."Line No.";
Could you post the code which modifies the Transfer Header.
Transfer header
Does the error say "Transfer Header" or "Transfer Line"?
Sohail Ahmed
2
mmv
2
Amol Salvi
2