cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Script Error

ivan_leonardo
Participant
0 Kudos

HI,

I have a SQL Script and it return error, I can't find what's wrong, any Idea ? Thanks

I am using SAP B1 9.0 PL 10 For HANA

Error Message :

1). [SAP AG][LIBODBCHDB32 DLL][HDBODBC32] Syntax error or access violation;257 sql syntax error: line 1 col 8  '' (SWEI) (at pos 😎

SELECT T8."DEPT",T8."CardCode",

SUM(T8."TOTAL") AS "Sales Revenue",

MAX(T4."U_VALLC") AS "BUDGET", SUM(T8."TOTAL")-MAX(T4."U_VALLC") AS "ACHIEVE",

(SUM(T8."TOTAL")/MAX(T4."U_VALLC"))*100 AS "% ACHIEVE",

SUM(T8."GP") AS "GP",(SUM(T8."GP")/SUM(T8."TOTAL"))*100 as "% GP"

FROM

(

SELECT T0."CardCode",SUBSTRING(T1."WhsCode",3,2) AS  "DEPT",MAX(MONTH(T0."DocDate")) AS "BLN", MAX(YEAR(T0."DocDate")) AS "THN", 

SUM(T1."LineTotal") AS "TOTAL",

SUM( T1."LineTotal"-(T1."StockPrice"*T1."Quantity")) AS "GP"

FROM OINV T0

INNER JOIN INV1 T1 ON T0."DocEntry" = T1."DocEntry"

INNER JOIN OITM T3 ON T3."ItemCode" = T1."ItemCode"

WHERE T0."CANCELED" ='N' AND  T0."DocType" ='I' AND T1."WhsCode"<>'01'

AND T0."DocDate" BETWEEN [%0] AND [%1]

GROUP BY SUBSTRING(T1."WhsCode",3,2),T0."CardCode"

)

T8

LEFT JOIN

(

SELECT T0."U_DEPT",T0."U_BLN",T0."U_THN",T0."U_VALLC" FROM "@TDP_BUDGETDEPT" T0

) T4 ON T4."U_DEPT" = T8."DEPT" AND T4."U_BLN" = T8."BLN" AND T4."U_THN" = T8."THN"

GROUP BY T8."DEPT",T8."CardCode"

Accepted Solutions (0)

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Can you highlight line 1 col 8 in above query?

Thanks & Regards,

Nagarajan

ivan_leonardo
Participant
0 Kudos

Here Naga, all the line 1

SELECT T8."DEPT",T8."CardCode",

SAP Query Generator sometimes having strange behavior

Rgds,

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

I need to check above query in your DB.

Thanks & Regards,

Nagarajan