cancel
Showing results for 
Search instead for 
Did you mean: 

PO qty more or less

Former Member
0 Kudos

Hi All,

I need the system to trigger an approval procedure if the GRPO qty is more or less than the PO qty, If its the same, then there should be no trigger.

I checked this thread:

But it triggers approval for every GRPO. Please assist.

Thanks,

joseph

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Joseph,

The correct query is like this:

SELECT Distinct 'TRUE'

FROM dbo.PDN1 T0

INNER JOIN dbo.POR1 T1 ON T0.BaseENtry = T1.DocEntry AND T0.BaseLine = T1.Linenum

INNER JOIN dbo.OPDN T2 ON T2.DocEntry = T0.DocEntry

WHERE T1.Quantity != $[$38.11.number\] AND T1.ItemCode = $[$38.1.0\] AND T2.DocNum = $[$8.0.0\]

Thanks,

Gordon

Former Member
0 Kudos

Hi Gordon,

First of all Congrats for the milestone of 35k+ points

I tried the query suggested by you but its not workin for any of the case where GRPO qty is more or less than PO quantity. What might be the reason and also i would like to know why have you used *1.05??

Thanks,

Joseph

Former Member
0 Kudos

That is copied from the other thread. In your case, no need for * 1.05 but change to != to try.

Former Member
0 Kudos

Hi Gordon,

I tried as suggested by you. The user was unable to add the document but the document didnt go for approval. It shows a message thet Could not commit transaction (ADOC). I was able to add the doc with changes with manager id.

Thanks,

Joseph

Former Member
0 Kudos

Hi Gordon,

The query suggested by Taimoor works in my case.

Declare @OpenPOQty numeric(19,6)

Declare @documentQty numeric(19,6)

set @documentQty=$[$38.11.Number]

set @OpenPOQty=(select opencreqty from por1 where docEntry=$[$38.45.Number] and lineNum=$[$38.46.Number])

select distinct 'true' where @documentQty>@OpenPOQty

Thanks,

Joseph