Hi Everybody.
I want check Item exits on table Stockkeeping Unit (ID 5700) If not exist then error.
I wrote the code below. But it can not be filtered for the case
SETFILTER("Gen. Prod. Posting Group",'POS'); //on Sales Line
Quantity - OnValidate() SkuItem.RESET; Rec.RESET; SETFILTER("Document Type",'%1',"Document Type"::Order); SETFILTER("Gen. Prod. Posting Group",'POS'); SETFILTER(Type,'Item'); SkuItem.SETRANGE("Item No.","No."); SkuItem.SETRANGE("Location Code","Location Code"); IF SkuItem.ISEMPTY THEN ERROR('Stockkeeping Unit %1 not found in Location Code %2',"No.","Location Code");
Please help me solution, to fix this case. Thanks so much
Best Regards,
dinhson
Dear Gary.
WIth code above. I added two test conditions on the Item Code
ItemRec.SETFILTER("Costing Method",'%1',ItemRec."Costing Method"::Standard);ItemRec.SETFILTER("Inventory Value Zero",'%1',FALSE);
And write code again. But it's not work. Please help me.
Rec.RESET; SkuItem.RESET; ItemRec.RESET; SETFILTER(Type,'>0'); ItemRec.SETFILTER("Costing Method",'%1',ItemRec."Costing Method"::Standard); ItemRec.SETFILTER("Inventory Value Zero",'%1',FALSE); SkuItem.SETRANGE("Item No.",ItemRec."No.","No."); SkuItem.SETRANGE("Location Code","Location Code"); SkuItem.SETRANGE("Item No.","No."); IF NOT SkuItem.FINDSET THEN ERROR('Stockkeeping Unit %1 not found in Location Code %2',"No.","Location Code");
Thank so much