Skip to Content

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

Alert query not working based on expiry date

Hi Experts,

I want to set up an alert for a UDF fields in my Sales Order Title based on the date which is put. The field is expiry date and I want that before 7 days of expiry date Alert should pop up. I am using the below query but No Alert is coming which is already set in Alert Management

I also want that 2 alerts should come which is before 7 days and before 15 days of expiry date.

declare @datevar datetime 
select @datevar = getdate()
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[U_LCVal], T0.[U_LCSDate], T0.[U_LCEdate] FROM ORDR T0 WHERE DATEDIFF(DD, T0.U_LCEdate, @datevar) > 7

Please guide what might be wrong.

Regards,

kamlesh

Former Member
Former Member replied

hi,

SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[U_LCVal], T0.[U_LCSDate], T0.[U_LCEdate] FROM ORDR T0 WHERE DATEDIFF(DD, T0.U_LCEdate, getdate()) <= 7
OR DATEDIFF(DD, T0.U_LCEdate, getdate()) <= 15

Jeyakanthan

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