Can any one give me idea where i put code to check negative inventory validation.
thanks in advance,
shailesh
Can any one give me idea where i put code to check negative inventory validation.
thanks in advance,
shailesh
1.Enable stockout warning in Sales setup
2.Disable programmatically YES button on stockout warning form.
suppose there is no inventory in my stock, at that time i return the purchase order, than the inventory goes negative, i want to check for this.
Regards,
Shailesh
Code unit 22 Check the function = InsertItemLedgEntry
THEN
ERROR(Text005,ItemLedgEntry.“Item No.”);
after above code write the following code.
// To stop the negative inventory
IF (ItemLedgEntry.Quantity < 0) THEN BEGIN
ERROR(‘This transaction will cause the inventory levels for item %1 for location %2 to go negative’, ItemLedgEntry.“Item No.”,ItemLedgEntry.“Location Code”);
END;
//to stop the negative inventory
Hope you will ship the Purchase Return Order after the Item is leaving the building…Item can’t leave the building if you don’t have it.
HI,
THIS CODE IS NOT WORKING
Shailesh
We have already discussed the above post earlier too
http://dynamicsuser.net/forums/p/53878/282708.aspx#282708
My question is again same How you can return material to vendor without having inventory.
Are you copying purchase invoice for returning the material ?
Are you manually doing the purchase return order ?
If you are doing manully then you can put your control on quantity field on Purchase Line for not allowing negative inventory
As well as you can put control in CU 90/21 also so it will check before posting the return order
I will write code as below in CU 90
Define one function as CheckInventory
Function code
LocQty := 0;
CLEAR(recItem);
IF (“Document Type”=“Document Type”::“Return Order”) AND (Type = Type::Item) AND (“No.” <> ‘’) THEN BEGIN
recItem.SETFILTER(recItem.“No.”,“No.”);
recItem.SETFILTER(recItem.“Location Filter”,“Location Code”);
IF recItem.FINDFIRST THEN BEGIN
recItem.CALCFIELDS(Inventory);
LocQty := recItem.Inventory;
END;
END;
EXIT(LocQty);
Then call function as below wherver you want
IF (“Document Type”=“Document Type”::“Return Order”) AND (Type=Type::Item) THEN
BEGIN
CheckQty:=CheckInventory();
IF “Quantity (Base)” > CheckQty THEN
ERROR('Sufficient Inventory not available for Return.Kindly check the Inventory ');
END;