cancel
Showing results for 
Search instead for 
Did you mean: 

GRPO Qty must not Exceed the PO Qty

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186095
Active Contributor
0 Kudos

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,

Answers (0)