Hello,
I have a program that imports items with some logistic information
I can't reproduce the code here - too much
But what happens is strange enough :
I get the error :
The Item cross reference already exists.
Identification fields and values:
Item No.='xxx',Variant Code='',Unit of Measure='yyy',Cross-Reference Type='Bar Code',Cross-Reference Type No.='',Cross-Reference No.='zzz'
And when debugging : it happens on a FINDFIRST
ItemCrossReference.RESET;
Specific CODEUNIT :
...
ItemCrossReference.SETRANGE("Item No.",Item."No.");
ItemCrossReference.SETRANGE("Unit of Measure",ItemLogisticVariant.Code);
ItemCrossReference.SETRANGE("Cross-Reference Type",ItemCrossReference."Cross-Reference Type" :: "Bar Code");
ItemCrossReference.SETRANGE("Cross-Reference No.",XRecItemLogisticVariant."EAN Code");
IF ItemCrossReference.FINDFIRST THEN BEGIN
<--- error happens here
ItemCrossReference."Discontinue Bar Code" := TRUE;
ItemCrossReference.MODIFY(TRUE);
END;
I could accept that already exists message appears on insert statement
But on FINDFIRST !?
Perhaps related to Insert Buffers - I read a post about it but could not really figure out how to come to a solution
Please if you have any hint how to avoid this error message - would be nice
Thanks
PS : I have always this smileys that come up every time I write a post - is there way to avoid this ?
Answers
So you need to look at the code where you are creating a new ItemCrossReference - you are probably not using the right (or not all) filters when checking if you need to create a new Item Cross Reference record.