Transaction Notification before Reciept of Final Product (Actual Issued must be equal to Actual Planned quantity in Production Order)
Hi all SAP experts,
Some days before i needed a Transaction Notification to Block the Receipt of final product whose actual issued quantity is not equal to planned quantity in production order. So first of all i tried to find on SCN and some other B1 sites but did not find any solution,then after that i made a Store procedure which i am sharing with you all.
IF @object_type=’59’ AND @transaction_type = ‘A’
Begin
IF EXISTS(SELECT B1.DocEntry
FROM OWOR A INNER JOIN
WOR1 A1 ON A.DocEntry = A1.DocEntry INNER JOIN
IGN1 B1 ON A.ItemCode = B1.ItemCode AND A.DocNum=B1.BaseRef
WHERE A1.PlannedQty<>A1.IssuedQty and a.ItemCode=B1.ItemCode
and B1.DocEntry = @list_of_cols_val_tab_del
GROUP BY A.DocNum,B1.ItemCode,A1.ItemCode,A1.PlannedQty,A1.IssuedQty,b1.DocEntry
)
BEGIN
SELECT @Error = 1, @error_message = ‘Actual Issued must be equal to planned quantity’
END
END
Hope this will help to block the Transaction 🙂 .
Thanks & Regards,
Manish
try below..
------------------------You can not issue more then planned------------------
IF (@object_type = '60' AND @transaction_type= 'A')
and (Select top 1 i.BaseType from IGE1 i
Where i.DocEntry = @list_of_cols_val_tab_del)=202
BEGIN
if exists
(Select p.DocEntry
From WOR1 p
Where
p.DocEntry=(select top 1 i.BaseEntry from IGE1 i where i.DocEntry = @list_of_cols_val_tab_del)
and p.PlannedQty<p.IssuedQty)
Begin
set @error =1
set @error_message = 'You can not issue more then planned !'
End
END