I had the same problem...
This error apears when you have two objects of the same record.
PurchaseHeader1 and PurchaseHeader2 for instance.
PHP код:
PurchaseHeader1.GET("Document Type"::Order,'PH00001');
PurchaseHeader2.GET("Document Type"::Order,'PH00001');
PurchaseHeader1.SomeField:=SomeValue;
PurchaseHeader1.MODIFY;
// after this you'll have problems with PurchaseHeader2
// 'cause in cache PurchaseHeader2 differs quite from
// Purchase Header in SQL database
//therefore you should make
PurchaseHeader2.GET("Document Type"::Order,'PH00001');
//and then error will disappear
I suppose the problem is in your local modifications