cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax error while creating Calculation view script based

former_member196080
Participant
0 Kudos

Hi Folks,

I'm creating Calc view based on script and drafted a simple code but I'm getting syntax error.

Its just fetching few coloumns from two tables products and purchaseorderitem.

/********* Begin Procedure Script ************/

BEGIN

  var_out = select productid , category, nameid, currency, grossamount, quantity

  FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B

  where P.productid = B.productid;

END /********* End Procedure Script ************/

Could you pls take a look and let me know what wrong I'm doing?

Error logs are:-

  • sap.hana..package.project.folder.mytest.CALCSCRIPTVIEW
    • Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: sql syntax error: incorrect syntax near "democontent": line 5 col 18 (at pos 439)nSet Schema DDL statement: set schema "SYSTEM"nType DDL: create type "_SYS_BIC"."sap.hana..package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" as table ("PRODUCTID" NVARCHAR(10), "CATEGORY" NVARCHAR(2), "NAMEID" NVARCHAR(10), "CURRENCY" NVARCHAR(5), "GROSSAMOUNT" DECIMAL(15,2), "QUANITYT" DECIMAL(13,3))nProcedure DDL: create procedure "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc" ( OUT var_out "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data as n /********* Begin Procedure Script ************/ n BEGIN n t var_out = select productid , category, nameid, currency, grossamount, quantityn t FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS Bn t where P.productid = B.productid;nnEND /********* End Procedure Script ************/n

Accepted Solutions (1)

Accepted Solutions (1)

former_member182302
Active Contributor
0 Kudos

Hi Rubane,

Use this Select statement:


select  P."ProductId" , "Category","NameId", P."Currency", "GrossAmount", "Quantity"

  FROM "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::products" AS P ,

"SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::purchaseOrderItem" AS B

  where P. "ProductId" = B."ProductId";

The issue is due to case sensitivity and the . or : coming in the name. You have to use " ". And also you have missed mentioning the schema name.

Starting with, try with simple SQL in SQL editor as mentioned by Fernando

Regards,

Krishna Tangudu

former_member196080
Participant
0 Kudos

thanks guys it solved my issue but why I need to use" ".?

former_member182302
Active Contributor
0 Kudos

Because you have camel case i.e ProductID . If you don't use " ", it will be taken as PRODUCTID instead of ProductID.

Regards,

Krishna Tangudu

Answers (1)

Answers (1)

former_member182114
Active Contributor
0 Kudos

Hi Rubane,

I don't have EPM installed here but based on this   you are not properly defining the source table.

In your case missing 1) schema of EPM, 2) not using double quotes, 3) separation of package and view, 4) missing camel case on purchaseOrderItem:

FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B

On blog:

from "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::businessPartner" as a

SAP_HANA_EPM_DEMO is the schema

sap.hana.democontent.epm.data is the package

businessPartner is the view

Start simple... before the seletion try it out on Studio SQL.

Regards, Fernando Da Rós