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
Hi Dinhson,
Those filters (in ItemRec) do not affect to SkuItem var... The problem is that I don't understand why you do all other filters.
To check if there are some rec in SkuItem, is enought do this (if you don't need to do anything with SkuItem):
SkuItem.SETRANGE("Location Code","Location Code"); SkuItem.SETRANGE("Item No.","No."); IF SkuItem.ISEMPTY THEN ERROR('Stockkeeping Unit %1 not found in Location Code %2',"No.","Location Code");
Hi Llaneras,
ItemRec is table Item (ID-27)
I want to filter the item conditional :
+ Item it's : "Costing Method"=Standard Or "Inventory Value Zero" = FALSE
Item have other conditions will not filter. Because I have use the "Cost Method" item = Average. Item does not have SKU on Location Code.
Thanks so much.