I want to control stock out level when I post an order and I wrote the following code in codeunit 80. Runtime occurs an error.Pls help :-k
Item No."does not exist
Note : SL is defined in Globals depending on Sales Line table.When I modify line of Item.GET('123456') any error occurs.
Item.GET(SL."No.");
Item.SETFILTER("Location Filter","Location Code");
//Item.SETFILTER("Variant Filter","Variant Code");
Item.CALCFIELDS(Inventory);
IF Item.Inventory <=0 THEN BEGIN
ERROR(Text045);
END;
0
Comments
Try:
SL := SalesLine;
or just use SalesLine."No."
Make sure that SalesLine.Type = Item before you try to use Item.GET(SalesLine."No.").