Check Item exist in Stockkeeping Unit

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

Related
Recommended