Error on a simple inventory count import

Hi all,

Can someone please tell me why my code would error out on CU 5402 UOM Mgmt, specifically at the Item.Testfield("No.) line under GetQtyPerUnitofMeasure function? Below is my code to import 6 columns of data: locationcode,item,variantcode,qty,UOM,BusinessEntity.

I already set up a Item Journal template called Item with batch name = AU007. I can't understand why it would error out. Please help.

I have included the data from my csv file here...


AU007 A045 001-00 1 EA AU
AU007 A045 1882-00 1 EA AU
AU007 A045 1887-00 -1 EA AU
AU007 A045 511-00 1 EA AU


The error is You must specify No. in ItemNo?



Integer - OnBeforeImportRecord()
LocationCode := '';
ItemNo := '';
VariantCode := '';
Qty := '';
UOM := '';
BusinessEntity := '';

Integer - OnAfterImportRecord()
LineNo += 10000;

WITH ItemJnlLine DO BEGIN
INIT;
"Journal Template Name" := 'ITEM';
"Journal Batch Name" := 'AU007';
"Line No." := LineNo;
"Reason Code" := 'COUNT';
INSERT(TRUE);

"Posting Date" := 020117D;
VALIDATE("Entry Type",ItemJnlLine."Entry Type"::"Positive Adjmt.");
"Document No." := 'AU_invcount';
IF EVALUATE("Location Code",LocationCode) THEN
VALIDATE("Location Code");
IF EVALUATE("Item No.",ItemNo) THEN
VALIDATE("Item No.");
IF EVALUATE("Variant Code",VariantCode) THEN
VALIDATE("Variant Code");
IF EVALUATE(Quantity,Qty) THEN
VALIDATE(Quantity);
IF EVALUATE("Unit of Measure Code",UOM) THEN
VALIDATE("Unit of Measure Code");
IF EVALUATE("Shortcut Dimension 2 Code",BusinessEntity) THEN
VALIDATE("Shortcut Dimension 2 Code");
MODIFY(TRUE);
END;

Best Answer

Answers

  • MisConsultngMisConsultng Member Posts: 17
    Thanks for pointing this out. I believe you are right on about this error. I found out shortly after that many of our items, due to some issues with the dataport (most likely the lack of validation) that the Base UOM looks fine on the surface/item card, but when you drill down to get to the Item UOM table the Code field is blank!
Sign In or Register to comment.