Hi Anantha,
Try this SP...
This SP restrict you to delete row item from Production order if it is linked with Bill of material.
I'll suggest you to put one more condition here to restrict End user to add other item which is not mentioned in BOM in production order.This SP will help you to resrtict end user on both condition...
IF @transaction_type IN ('A', 'U')AND @object_type in ('202')
BEGIN
If exists (SELECT Distinct T0.DocEntry,T1.ItemCode FROM OWOR T0
inner join ITT1 T2 on T2.Father = T0.Itemcode
Inner Join WOR1 T1 on T1.DocEntry=T0.DocEntry
where T0.DocEntry =20 AND T2.code not in
(SELECT T1.itemcode FROM WOR1 T1 where T0.Docentry = T1.DocEntry)OR T1.ItemCode not in
(Select Code From ITT1))
Begin
SET @error = '202'
SET @error_message = N'order can not be added if not match with BOM.'
End
END
For History details like amendment and deletion you can refer Log Detials.
Open form first goto Tool--Change Log and click on it'll show you histroy instance.
For More Details Follow this Query:
SELECT * FROM AWO1 T0
or use this...
Select Distinct Code From ITT1 where Code Notin(Select ItemCode from WOR1)