NAV 2009 RTC Error on Record.GET function


I did an upgrade for a client from NAV 5.0 to NAV 2009 SP1. The Classic Client works fine but the RTC doesn’t. When posting purchase invoices it brings and error message “The primary key definition of the purchase line table has changed. start your activity again”. On posting shipment for service order it gives the error “The primary key definition of the service line table has changed. start your activity again”. I followed this second one (Service order) using visual studio debugger and found the exact point where it is thrown :- Codeunit 5988: FinalizeLines() function. The generated C# looks like this:

private void FinalizeLines()


// IF ServLine.FIND(’-’) THEN

if(servLine.Target.ALFind(DataError.TrapError, @"-"))





// IF PServLine.GET(“Document Type”,“Document No.”,“Line No.”) THEN BEGIN

if(pServLine.Target.ALGetSafe(DataError.TrapError, 462791, ( (NavOption)(servLine.Target.GetFieldValueSafe(1, NavType.Option)) ), ( (NavCode)(servLine.Target.GetFieldValueSafe(3, NavType.Code)) ), ALCompiler.ToNavValue(servLine.Target.GetFieldValueSafe(4, NavType.Integer).ToInt32())))


// PServLine.COPY(ServLine);

The commented lines are the original C/AL code

The error is caused by the line:

PServLine.GET(“Document Type”,“Document No.”,“Line No.”)

Does anyone have any idea why this would happen and why it only happens in RTC and not in classic client?