Skip to Content
0
Jun 17, 2021 at 01:11 PM

SPT for Production Order Block also block Issue for Production and Receipt from Production

34 Views

Dear Experts

I had created a SPT to block Production order on certain Condition

and its working fine in Production order Window, but at the same time when am trying to generate any Issue for Production and Receipt From Production, the Same SPT is blocking

Pls help me to Fix this issue ,

 If (@object_type='202' and @transaction_type in ('U'))
BEGIN


if exists( 
select T0.DocEntry,T1.ITEMCODE,T1.PlannedQty,T3.OnHand
FROM OWOR T0 INNER JOIN WOR1 T1


ON T0.DOCENTRY = T1.DOCENTRY AND T0.DocEntry=@list_of_cols_val_tab_del INNER JOIN OITM T2 ON T2.itemcode = 
T1.itemcode INNER JOIN OITW T3 on T1.ITEMCODE = T3.ItemCode
AND T1.wareHouse=T3.WhsCode


where (T1.ItemCode like '2%' or T1.ItemCode like 'PM%' OR T1.ItemCode like '1%' or T1.ItemCode like 'RM%') and T1.PlannedQty>T3.OnHand
AND T0.[Status]='R'
)


BEGIN
SET @error=1
SET @error_message='Production order cannot be released as there is no sufficient stock of components'


END


END

Regards

VINOD