on 09-15-2014 9:52 AM
Dear Expert,
I am trying the following query in Hana Studio.....
SELECT * from (select T0."ItemCode" as Code, T1."WhsCode" as Whs, sum(T1."OnHand") as Stock FROM OITM T0 INNER JOIN OITW
T1 ON T0."ItemCode" = T1."ItemCode" INNER JOIN OWHS T2 ON T1."WhsCode" = T2."WhsCode" WHERE T2."U_Type_Of_Whs" = 'STATION'
and T1."WhsCode" <> 'HO' group by T0."ItemCode",T1."WhsCode" ) P Pivot(Sum(Stock) for Code in (PMS001,AGO001,IK001)
) as pvt
and I am receiving the error incorrect syntax near "Pivot": line
Please suggest the solution.
regards,
PankajK
Hi Pankaj,
I am also getting the same error "
SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "PIVOT" , did you resolve it ?
If yes , can you pls tell me the steps to resolve the issue.
Thanks,
Hemapriya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
try putting the itemcodes in square brackets.
SELECT * from (select T0."ItemCode" as Code, T1."WhsCode" as Whs, sum(T1."OnHand") as Stock FROM OITM T0 INNER JOIN OITW
T1 ON T0."ItemCode" = T1."ItemCode" INNER JOIN OWHS T2 ON T1."WhsCode" = T2."WhsCode" WHERE T2."U_Type_Of_Whs" = 'STATION'
and T1."WhsCode" <> 'HO' group by T0."ItemCode",T1."WhsCode" ) P
Pivot(Sum(Stock) for Code in ([PMS001],[AGO001],[IK001])
) as pvt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I copied your query and justr removed the U_Type_of_whs because I don't have this field and the query is running fine.
Is the name of field correct?
If it's correct add the U_Type_of_whs in the group by
T2."U_Type_Of_Whs" = 'STATION' and
I hope it helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this:
SELECT * from (select T0."ItemCode" as Code, T1."WhsCode" as Whs, sum(T1."OnHand") as Stock FROM OITM T0 INNER JOIN OITW
T1 ON T0."ItemCode" = T1."ItemCode" INNER JOIN OWHS T2 ON T1."WhsCode" = T2."WhsCode" WHERE T2."U_Type_Of_Whs" = 'STATION'
and T1."WhsCode" <> 'HO' group by T0."ItemCode",T1."WhsCode" ) P
Pivot(Sum(Stock) for Code in (PMS001,AGO001,IK001)
)) as pvt
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this query and working in SAP B1 query generator:
SELECT * from (select T0.ItemCode as Code, T1.WhsCode as Whs, sum(T1.OnHand) as Stock FROM OITM T0 INNER JOIN OITW
T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OWHS T2 ON T1.WhsCode = T2.WhsCode WHERE
T1.WhsCode <> 'HO' group by T0.ItemCode,T1.WhsCode ) P
Pivot(Sum(Stock) for Code in (PMS001,AGO001,IK001)
) as pvt
OR Try this query in your DB
SELECT * from (select T0."ItemCode" as Code, T1."WhsCode" as Whs, sum(T1."OnHand") as Stock FROM OITM T0 INNER JOIN OITW
T1 ON T0."ItemCode" = T1."ItemCode" INNER JOIN OWHS T2 ON T1."WhsCode" = T2."WhsCode" WHERE T2."U_Type_Of_Whs" = 'STATION'
and T1."WhsCode" <> 'HO' group by T0."ItemCode",T1."WhsCode" ) P
Pivot(Sum(Stock) for Code in (PMS001,AGO001,IK001)
) as pvt
Thanks & Regards,
Nagarajan
Hi,
Did you receive any error message if run my latest query in HANA?
Please refer this document for HANA
http://scn.sap.com/docs/DOC-48357
Thanks & Regards,
Nagarajan
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.