Hi,
Just adhd array alias, past your query works
try this
SELECT T0."DocEntry" AS "Document ID", T0."DocNum" AS "Invoice Number", T0."DocDate" AS "Document Date", T0."CardCode" AS "Partner Code", T0."CardName" AS "Partner Name", T1."ItemCode" AS "Item Code", T2."ItemName" AS "Item Name", T1."AcctCode" AS "GL Account", T1."OcrCode" AS "Cost Center", T1."OcrCode2" AS "Division", T1."OcrCode5" AS "Other Data", T1."LineTotal" AS "Line Total Price" FROM OPCH T0 JOIN PCH1 T1 ON T0."DocEntry" = T1."DocEntry" LEFT JOIN OITM T2 ON T1."ItemCode" = T2."ItemCode" WHERE T0."DocDate" BETWEEN '[%0]' AND '[%1]' AND (T1."OcrCode" = '[%2]' OR '[%2]' IS NULL) AND (T1."OcrCode" IS NOT NULL OR '[%3]' = 'Y') ORDER BY T0."DocNum", T1."LineNum";