I need to query an aging report base on SAP HANA DAYS_BETWEEN function. The module that I'm trying to get the data is in AP Invoice module. Basically the format is just like this:
Count the column name T0.TaxDate upto the current system date.
Here is my code:
SELECT T0."DocNum" "A/P Invoice #",T0."CardCode",T0."CardName",
CASE WHEN T0."DocType" = 'S' THEN 'SERVICE'
ELSE 'ITEM' END AS "Item/Service Type", T0."NumAtCard" "Vendor Ref.",
CASE WHEN T0."DocStatus" = 'O' THEN 'OPEN' ELSE 'CLOSE' END AS "Document Status",
T0."DocDate",T0."DocDueDate" AS "Due Date",
T0."TaxDate" AS "Document Date",T0."DocCur",T0."DocTotalFC",T0."DocTotal",
DAYS_BETWEEN(T0."TaxDate", CURRENT_DATE) AS "AGING"
FROM OPCH T0 Where T0."DocStatus" = 'O'
Thanks in advance
