on 04-24-2015 5:07 AM
Hi all,
I need to block the GRPO Document when adding it if the Qty in the GRPO is greater than the PO Qty.
But this Stored Procedure blocks me even when i raise the GRPO with Qty less than the PO Qty.
IF @transaction_type IN ('A') AND
(@Object_type = '20')
BEGIN
IF EXISTS (SELECT T1.BaseEntry
FROM dbo.OPDN T0
INNER JOIN dbo.PDN1 T1 ON T1.DOCENTRY = T0.DocEntry
INNER JOIN dbo.POR1 T2 ON T2.DOCENTRY = T1.BaseEntry
WHERE T1.BaseType = '22' AND
T1.ItemCode = T2.ItemCode AND
T1.BaseLine = T2.LineNum AND
T0.DOCENTRY = @list_of_cols_val_tab_del
GROUP BY T1.BaseEntry
HAVING SUM(T1.Quantity) > SUM(T2.OpenQty))
Begin
SELECT @Error = 10, @error_message = 'GRPO quantity is greater than PO quantity'
End
END
Is something wrong with this SP...
Hi
Check bellow Sp
--------------- Validation for Goods Receipt PO Restricting Excess Qunatity ----------------------------
IF @Object_type = '20' and @transaction_type = 'A'
BEGIN
declare @line int
SELECT @line = (LineNum + 1)
From PDN1
Where PDN1.DocEntry = @list_of_cols_val_tab_del
and (Quantity > BaseOpnQty)
Order by LineNum
If (not ISNULL(@line, 0) = 0)
begin
Set @error = 10
Set @error_message = 'Line quantity' + CONVERT(nvarchar(4), @line) +' is more then open quantity !'
end
END
Thanks& Regards
AndakondaRamudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.