The record in table Warehouse Receipt Line already exists.

Hello, I was trying to add purchase line into warehouse receipt line and when Insert() triggers I get

“The record in table Warehouse Receipt Line already exists.”

However, warehouse receipt line doesn’t have that purchase line.

WhseRecLine.Init();
WhseRecLine.Validate(“Source No.”, THOPONO);
WhseRecLine.Validate(“Item No.”, ITEM);
WhseRecLine.Validate(“Description”, purchLine.Description);
WhseRecLine.Validate(“Invoice No.”, “TGINV1 & TGINV2”);
Evaluate(whseQty, JpnTranDet.THQTY);
WhseRecLine.“Quantity” := whseQty;
WhseRecLine.SetRange(“No.”, whsenum);
WhseRecLine.Insert();

here is my code

Primary Key in Warehouse receipt line is No., Line No., where you inserting the Line No. you need something like this.

WhseRecline.reset;

if whserecline.find(’+’) then

LineNo := whserecline.“line no.” + 10000

else

LineNo := 10000;

WhseRecLine.Init();
WhseRecLine.Validate(“Item No.”, ITEM);

whserecline.“line no.” := lineno;

xxxyour other fields come below

whserecline.insert;

Without primary key how can you insert a record.