Skip to Content
0
Sep 19, 2020 at 04:01 AM

SP Notification to Block Production Order if Itemcode exists with Planned status

45 Views

SP Notification to Block Production Order if Itemcode exists on the Production Order with Planned status.

Hello there!

Following is my code but it doesn't work:

@@@

IF @object_type = '202' AND @transaction_type IN ('A')

BEGIN IF EXISTS (SELECT OWOR.ITEMCODE FROM OWOR

WHERE OWOR.ITEMCODE IN (SELECT T1.ItemCode FROM OWOR T1 WHERE T1.STATUS = 'P'))

BEGIN set @error =2

set @error_message = 'Adding itemcode with existing planned status not allowed!'

END

END

@@@

Thanks!