on 2014 May 23 7:52 AM
Dear Experts,
Here I am validating the Production order items with BOM for the same items, any addition or deletion in production order should not be allowed. Hence the production order should consist of same items what it has in BOM. But below the my query is allowing this scenario. Kindly help me to achieve the same..
Query Follows :
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@object_type = '202' and @transaction_type in ('A','U')
if exists (SELECT distinct 'error'
FROM OITT A INNER JOIN ITT1 B ON A.Code = B.Father
LEFT JOIN OWOR C ON C.ItemCode = A.Code
LEFT JOIN WOR1 D ON D.DocEntry = C.DocEntry
LEFT JOIN OITM E ON E.ItemCode = B.Code AND D.ItemCode = B.Code
Where c.DocEntry = @list_of_cols_val_tab_del and d.ItemCode not in (select b.Code from ITT1 b))
Begin
Select @error = N'13002'
select @error_message = N'BOM Mismatch'
END
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks,
Bhoopathi.K
Hi,
Try this:
IF @transaction_type IN ('A', 'U')AND @object_type in ('202')
BEGIN
If exists (SELECT T0.DocEntry FROM owor T0
inner join itt1 t2 on t2.father = T0.Itemcode
where t0.DocEntry =@list_of_cols_val_tab_del AND t2.code not in (SELECT T1.itemcode FROM wor1 t1 where t0.docentry = t1.docentry))
Begin
SET @error = '202'
SET @error_message = N'order can not be added if not match with BOM.'
End
END
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.