on 02-11-2016 9:07 AM
Hi Experts I want to Stop Release the Production Order if certian components are not in Production Order for that i write a SP
-/*Block the update of Production Order if Inks & Solvents not Present */
IF @transaction_type IN ('U') AND @Object_type = '202'
BEGIN
IF EXISTS (SELECT T0.DocEntry FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry
Left Join OITM T2 on T2.ItemCode = T1.ItemCode
WHERE T0.ItemCode Like 'SF-P%%' and T0.Status = 'R' and
T0.DocEntry = @list_of_cols_val_tab_del and (T2.Series not in ('101') or T2.Series not in ('53')
or T2.Series not in ('164')or T2.Series not in ('103')or T2.Series not in ('55')))
BEGIN
SELECT @Error = 79, @error_message = 'Order Cannot Release Without Inks and Solvents'
END
END
the above SP is not working as per my requirement it is blocking its release either those items are present or not
Can any one tell me what am i missing in this sp?
Kind Regards,
Jamil
Thank you all guyz to help me out after all efforts finally my issue is resolved by the following SP
IF @transaction_type IN ('A','U') AND @Object_type = '202'
BEGIN
IF Exists (SELECT T0.DocEntry
FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry
Where T0.ItemCode Like 'SF-P%%' and T0.Status = 'R' and
T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
IF (SELECT Count(A.ItemCode)
From WOR1 A inner join OITM B on A.ItemCode = B.ItemCode
Where A.DocEntry = @list_of_cols_val_tab_del and B.Series in ('101','53','164','103','55')) < 1
BEGIN
SELECT @Error = 79, @error_message = 'Order Cannot Release Without Inks and Solvents'
END
END
END
Thanx & Regards
Jamil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this:
IF EXISTS (SELECT T0.[DocNum]
FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T1.[ItemCode] NOT IN (select t0.itemcode from OITM T0 where T0.itemcode = 'SF-P')and T0.Status = 'R' and
T0.DocEntry = @list_of_cols_val_tab_del and (T2.Series not in ('101') or T2.Series not in ('53')
or T2.Series not in ('164')or T2.Series not in ('103')or T2.Series not in ('55')))
BEGIN
SELECT @Error = 79, @error_message = 'Order Cannot Release Without Inks and Solvents'
END
END
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this:
IF @transaction_type IN ('U') AND @Object_type = '202'
BEGIN
IF EXISTS (SELECT T0.[DocNum]
FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T1.[ItemCode] NOT IN (select t0.itemcode from OITM T0 where T0.itemcode = 'SF-P')and T0.Status = 'R' and
T0.DocEntry = @list_of_cols_val_tab_del and (T2.Series not in ('101') or T2.Series not in ('53')
or T2.Series not in ('164')or T2.Series not in ('103')or T2.Series not in ('55')))
BEGIN
SELECT @Error = 79, @error_message = 'Order Cannot Release Without Inks and Solvents'
END
END
Sorry for that.
Try this:
IF @transaction_type IN ('U') AND @Object_type = '202'
BEGIN
IF EXISTS (SELECT T0.[DocNum]
FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry] Left Join OITM T2 on T2.ItemCode = T1.ItemCode
WHERE T1.[ItemCode] NOT IN (select t0.itemcode from OITM T0 where T0.itemcode = 'SF-P')
and T0.Status = 'R' and
T0.DocEntry = @list_of_cols_val_tab_del and (T2.Series not in ('101') or T2.Series not in ('53')
or T2.Series not in ('164')or T2.Series not in ('103')or T2.Series not in ('55')))
BEGIN
SELECT @Error = 79, @error_message = 'Order Cannot Release Without Inks and Solvents'
END
END
Hi Jamil,
Check this
-/*Block the update of Production Order if Inks & Solvents not Present */
IF @transaction_type IN ('A','U') AND @Object_type = '202'
BEGIN
IF EXISTS (SELECT T0.DocEntry FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry
Left Join OITM T2 on T2.ItemCode = T1.ItemCode
WHERE T0.ItemCode Like 'SF-P%%' and T0.Status = 'R' and
T0.DocEntry = @list_of_cols_val_tab_del and (T2.Series not in ('101','53','164','103','55')))
BEGIN
SELECT @Error = 79, @error_message = 'Order Cannot Release Without Inks and Solvents'
END
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamil
Did a quick test and it is working, try this:
IF EXISTS (SELECT T0.DocEntry FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry
Left Join OITM T2 on T2.ItemCode = T1.ItemCode
WHERE T0.ItemCode Like 'SF-P%%' and T0.Status = 'R' and
T0.DocEntry = @list_of_cols_val_tab_del and T2.Series not in ('101','53','164','103','55'))
BEGIN
SELECT @Error = 79, @error_message = 'Order Cannot Release Without Inks and Solvents'
END
Kind regards
Peter Juby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.