Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

GRPO Qty must not Exceed the PO Qty

Hi Experts,

I need a Query in such a manner that it should not allow me to add the GRPO if GRPO Qty exceeds.

Reply.

Mona.

replied

Hi,

you could use a SP_TN (store procedure transaction notification) to block the creation of GRPO if the quantity is exceeded the base quantity created in PO.

Here it is :

IF @transaction_type IN (N'A', N'U') AND

(@Object_type = N'20')

begin

if exists (SELECT T0.BaseEntry, SUM(T0.Quantity)

FROM [dbo].[PDN1] T0 INNER

JOIN [dbo].[POR1] T1 ON T1.DOCENTRY =

T0.BASEENTRY

WHERE T0.BaseType = 22 AND

T0.ItemCode = T1.ItemCode AND T0.BaseLine

= T1.LineNum

and T0.DOCENTRY = @list_of_cols_val_tab_del

GROUP BY T0.BaseEntry

HAVING (SUM(T0.Quantity) > SUM(T1.Quantity))

or sum(t0.quantity) > sum(t0.BaseOpnQty))

begin

select @Error = 10, @error_message =

'GRPO quantity is over PO quantity'

end

end

There is not need to create UDF or use SDK code.

Rgds,

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question