Dear Expert,
I am struggling in getting a transaction notification to work for blocking a receipt from production if there is already stocks for a certain item in a specific warehouse. Below is the query i am trying but not working any assistance on this is highly appreciated.
if @object_type='59' and @transaction_type='A'
BEGIN
Declare @Stocks as numeric(19, 6)
SELECT @Stocks = T0.[OnHand] FROM [dbo].[OITW] T0
Where T0.ItemCode = 'M01024' AND T0.WhsCode='PRODF'
BEGIN
IF EXISTS (SELECT T0.DocNum FROM OIGN T0 WHERE T0.DOCENTRY = @list_of_cols_val_tab_del AND @Stocks>0)
begin
SELECT @error=1, @error_message='To Proceed transfer the current stocks to finished goods'
END
END
END
Regards