Buen día, estoy generando un query en SAP B1 v 10.00 for SAP HANA 10.00.210 para generar unos kpi de cuenta de perdida y ganancias, pero me marca error:
Could not execute ‘SELECT CONCAT(’[%StartDate%]', ’ - ‘, ‘[%EndDate%]’) AS “Periodo”, ‘Ingresos Totales’ AS …’
SAP DBTech JDBC: [316]: wrong number of arguments in function invocation: line 2 col 5 (at pos 14)
El query es el siguiente:
SELECT
CONCAT('[%StartDate%]', ' - ', '[%EndDate%]') AS "Periodo",
'Ingresos Totales' AS "Descripción",
SUM(
CASE
WHEN T0."AcctCode" LIKE '4%' THEN T1."Credit" - T1."Debit"
ELSE 0
END
) AS "Monto"
FROM
OACT T0
INNER JOIN JDT1 T1 ON T0."AcctCode" = T1."Account"
WHERE
T1."RefDate" BETWEEN '2024-01-01'
AND '2024-12-31'
UNION ALL
SELECT
CONCAT('[%StartDate%]', ' - ', '[%EndDate%]') AS "Periodo",
'Gastos Totales' AS "Descripción",
SUM(
CASE
WHEN T0."AcctCode" LIKE '5%' THEN T1."Debit" - T1."Credit"
ELSE 0
END
) AS "Monto"
FROM
OACT T0
INNER JOIN JDT1 T1 ON T0."AcctCode" = T1."Account"
WHERE
T1."RefDate" BETWEEN '2024-01-01'
AND '2024-12-31'
UNION ALL
SELECT
CONCAT('[%StartDate%]', ' - ', '[%EndDate%]') AS "Periodo",
'Resultado Neto' AS "Descripción",
SUM(
CASE
WHEN T0."AcctCode" LIKE '4%' THEN T1."Credit" - T1."Debit"
ELSE 0
END
) - SUM(
CASE
WHEN T0."AcctCode" LIKE '5%' THEN T1."Debit" - T1."Credit"
ELSE 0
END
) AS "Monto"
FROM
OACT T0
INNER JOIN JDT1 T1 ON T0."AcctCode" = T1."Account"
WHERE
T1."RefDate" BETWEEN '2024-01-01'
AND '2024-12-31'
Me ayudan a revisar y ver como debe quedar?