cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR IN query report SAP BUSINESS ONE HANA

nikunjmehta2290
Participant
0 Kudos

Dear all,

[SAP AG][LIBODBCHDB DLL][HDBODBC] Syntax error or access violation;257 sql syntax error: incorrect syntax near "END": line 66 col 1 (at pos 2425)

Declare

BranchName varchar(50); BranchName := /* T3."BPLName" */ '[%0]';

Declare Warehouse varchar(50); Warehouse := /* T1."WhsCode" */ '[%1]';

Declare BatchType varchar(50); BatchType := /* T1."U_BTYPE" */ '[%2]'; Select

T3."BPLName",T0."ItemCode", T1."ItemName",IBH."MnfSerial" AS "BATCH NO",

T1."BatchNum" AS "BATCH ATT 1",(IBH."CostTotal"/CASE WHEN IBH."Quantity"=0 THEN 1 ELSE IBH."Quantity" END) AS "COST",IBH."U_UNE_MRP", ((IBH."CostTotal"/CASE WHEN IBH."Quantity"=0 THEN 1 ELSE IBH."Quantity" END)*

T1."Quantity") AS "TOTAL COST", T1."Quantity", Case When GP."GroupName" IN ('Distributor','Store') THEN SUM(T5."Quantity") ELSE 0 END AS "SalesCommit", -- T1."IsCommited", Case When GP."GroupName" IN ('CFA') THEN SUM(T5."Quantity") ELSE 0 END AS "InternalCommit", -- T1."IsCommited", (T1."Quantity"-

IFNULL(T1."IsCommited",0) ) As "FinalAvailableQTY", T1."WhsCode" , CASE WHEN IBH."ExpDate"<=CURRENT_DATE THEN 'Expired' WHEN MONTH(IBH."ExpDate")||YEAR(IBH."ExpDate")=MONTH(CURRENT_DATE )||YEAR(CURRENT_DATE) THEN 'Expired' WHEN IBH."ExpDate">=ADD_MONTHS(CURRENT_DATE,1) AND IBH."ExpDate"<=ADD_MONTHS(CURRENT_DATE,3) THEN 'Near Expired' ELSE 'Normal' END "Batch Status", T1."U_BTYPE", -- T1."Status", IBH."MnfDate",IBH."ExpDate" ,

IBH."U_MNFTR"

from oitm T0

INNER join oibt T1 on T0."ItemCode" = T1."ItemCode"

INNER JOIN OCRD BP ON T1."CardCode" = BP."CardCode" AND BP."CardType" = 'C'

INNER JOIN OCRG GP ON BP."GroupCode" = GP."GroupCode"

INNER JOIN ORDR T4 ON T4."CardCode" = BP."CardCode"

INNER JOIN RDR1 T5 ON T4."DocEntry" = T5."DocEntry"

LEFT OUTER JOIN OWTQ T8 ON T8."CardCode" = BP."CardCode"

INNER JOIN OBTN IBH On T1."ItemCode"=IBH."ItemCode" AND IBH."DistNumber"=T1."BatchNum"

INNER JOIN OWHS T2 ON T2."WhsCode"=T1."WhsCode" INNER JOIN OBPL T3 ON T2."BPLid"=T3."BPLId" --

Where

T1."Quantity">0 AND (:BranchName = '' OR T3."BPLName" = :BranchName) AND (:Warehouse = '' OR T1."WhsCode" = :Warehouse) AND (:BatchType = '' OR T1."U_BTYPE" = :BatchType)

Group By

T3."BPLName",T0."ItemCode", T1."ItemName", IBH."MnfSerial" ,T1."BatchNum" , IBH."CostTotal", IBH."Quantity",

IBH."U_UNE_MRP",

T1."Quantity",T1."IsCommited",

GP."GroupName" , T5."Quantity", T1."WhsCode" , IBH."ExpDate", T1."U_BTYPE", IBH."MnfDate",IBH."ExpDate" ,IBH."U_MNFTR"

nikunjmehta2290
Participant
0 Kudos

[SAP AG][LIBODBCHDB DLL][HDBODBC] Syntax error or access violation;257 sql syntax error: incorrect syntax near "END": line 66 col 1 (at pos 2425)

error

rskour78
Explorer
0 Kudos
/* select from "OBPL" T3 */
Declare BranchName varchar(50);
BranchName := /* T3."BPLName" */ '[%0]';
/* select from "OIBT" T1 */
Declare Warehouse varchar(50);
Warehouse := /* T1."WhsCode" */ '[%1]';
/* select from "OIBT" T2 */
Declare BatchType varchar(50);

BatchType := /* T2."U_BTYPE" */ '[%2]';

AND change table name oibt T1 by OITB T1

Accepted Solutions (0)

Answers (0)