on 06-25-2018 8:51 AM
Hi Gurus,
Can anyone help me to make a alert if GRPO Or AP Invoice Quantity is greater than PO quantity.
I have SP Notification for the same.
But my requirement is not to block GRPO or AP quantity if the quantity is greater than PO quantity but to send a alert to a user.
Use Query Only Not Complete SP like Below Because Alert run the select query and if there is any results it will send to users
try the below query
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
GROUP BY T0.BaseEntry
HAVING (SUM(T0. Quantity) > SUM(T0.BaseOpnQty))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
GROUP BY T0.BaseEntry
HAVING (SUM(T0. Quantity) > SUM(T0.BaseOpnQty))
Thanks Abdul its working. Appreciate for your time 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the same query you used in SP and Make alert based on same query with frequency of 1 minute query will run each minute and will check if there is any Results and alert will be generated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abdul, Thanks for the reply,
I tried the SP Notification query and made alert with freqvency 1 minute but it did not worked for me,
This is the query which i used
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(T0.BaseOpnQty)))
begin
select @Error = 10,
@error_message = 'GRPO quantity is Greater than the PO Quantity'
end
end
User | Count |
---|---|
107 | |
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.