Forum Navigation
You need to log in to create posts and topics.

Service Contracts Expiring within 60 days

It's always fun dealing with Dates in SAP Business One HANA. This query takes a real simple approach to determining what SAP Business One service contracts will be expiring within the next 60 days. Of course you can change the expiration "60" days to any number. You can even change the days to a negative. For example, if we change the 60 to a -30, that will show us contracts have have expired at least 30 days ago. So learning the ADD_DAYS function is really important.

SELECT T0."ContractID", T0."CstmrCode", T0."CstmrName", T1."ItemCode", T1."ItemName", T1."StartDate", T1."EndDate"
FROM OCTR T0 INNER JOIN CTR1 T1 ON T0."ContractID" = T1."ContractID"
WHERE T1."EndDate" > CURRENT_DATE AND T1."EndDate" <= ADD_DAYS(CURRENT_DATE,60)