Skip to Content

Syntax error while creating Calculation view script based

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
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Apr 08, 2014 at 12:07 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 08, 2014 at 12:03 AM

    Hi Rubane,

    I don't have EPM installed here but based on this Table User Defined Functions( Table UDF ) in HANA 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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.