Skip to Content
0
Former Member
Aug 06, 2016 at 12:22 AM

Qty GRPO greater than Qty PO

148 Views

Dear All Master,

Issue : My organization would like to block Qty in GRPO when it greater than PO, Entry Doc able to partial, i had tried follow the SP_query :

IF @transaction_type IN ('A', 'U') AND @Object_type IN ('20')

BEGIN

IF EXISTS

(

select

t1.BaseEntry

from dbo.OPDN t0

left 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,t2.Quantity,t2.OpenQty

Having sum(t1.Quantity) > sum(t2.openQty)

)

BEGIN

SET @Error = 102217

SET @Error_message = N'Warning : "Qty GPRO harus besar sama dengan atau lebih kecil dari Doc Base (PO)"'

END

END

But it didnt work for partial entry. please give the best quetion.

Thanks B4