Forum breadcrumbs - You are here:Free SAP Business One Queries for HANA and SQL DeploymentsSAP Business One HANA: SAP Business One HANA QueriesQuery - Service Contracts Expirin …
You need to log in to create posts and topics.
Query - Service Contracts Expiring within 30 days
32 Posts
#1 · June 4, 2020, 1:41 pm
Quote from Administrator on June 4, 2020, 1:41 pmI am posting this more for the Date function. In MS SQL, we used to be able to use variables like getdate()+30 to add 30 days from today. HANA is more SQL compliant, so some of the shortcuts we used to take, are no longer available.Here is a great little SAP Business One query I have setup as an alert, that notifies the desired user(s) when Service Contracts are within 30 days of expiration.
SELECT T0."ContractID",
T0."CstmrCode",
T0."CstmrName",
T0."Descriptio",
T0."StartDate",
T0."EndDate"
FROM OCTR T0
WHERE T0."EndDate" >= CURRENT_DATE AND T0."EndDate" < ADD_DAYS(CURRENT_DATE,30)
I am posting this more for the Date function. In MS SQL, we used to be able to use variables like getdate()+30 to add 30 days from today. HANA is more SQL compliant, so some of the shortcuts we used to take, are no longer available.
Here is a great little SAP Business One query I have setup as an alert, that notifies the desired user(s) when Service Contracts are within 30 days of expiration.
SELECT T0."ContractID",
T0."CstmrCode",
T0."CstmrName",
T0."Descriptio",
T0."StartDate",
T0."EndDate"
FROM OCTR T0
WHERE T0."EndDate" >= CURRENT_DATE AND T0."EndDate" < ADD_DAYS(CURRENT_DATE,30)
Click for thumbs down.0Click for thumbs up.0
