cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a Calculation View by HANA SQL?

frank_albrecht
Advisor
Advisor
0 Kudos
1,196

Tutorials: https://developers.sap.com/tutorials/hana-cloud-create-cube-calculation-view.html
--------------------------

Hi, is there a way to create the Calculation View by HANA SQL, like CREATE CALCULATION SCENARIO ...? Thanks Frank

krushii
Explorer
0 Kudos

https://www.youtube.com/watch?v=uqXrUdDTKKI

you can refer this tutorial link

frank_albrecht
Advisor
Advisor
0 Kudos

Hi,

thanks for the answers so far. My goal is to do Test-Driven development in JAVA on SAP BTP and I would like to create the Calculation View within my Tests. The Calculation View is then the bridge to the SAP Analytics Cloud - as this is the way to expose SAP HANA Cloud to the SAP Analytics Cloud.

Accepted Solutions (0)

Answers (5)

Answers (5)

jan_zwickel
Product and Topic Expert
Product and Topic Expert

Hi Frank,

calculation views are intended to be created in a graphical environment: SAP Business Application Studio with SAP HANA Cloud, SAP Web IDE on premise. Within the graphical calculation views you can include table functions.

If you really want to deploy calculation views via SQL then your challenge will be to get the corresponding XML first. If you have the XML that describes the calculation view (e.g., by opening the file in text-mode in Business Application Studio) you can deploy it via SQL within an HDI environment.

Best,

Jan

rybafish
Explorer
0 Kudos

Hi Frank,

I think for the tests the following approach will work for you (not supported by sap, etc, etc):

1. Find the runtime object of the example view. I think the easiest would be: something like select * from views where view_name = <your view>.

2. you can extract the create statement there, it is s plain text JSON string. Should look something like '{create column view...<...>}'

3. you should be able to execute this statement from step 2 in target environment.

Optionally you can make simple modifications before step 3: like change the view name, or target schema, etc.

frank_albrecht
Advisor
Advisor
0 Kudos

Hi, that’s what I did. The only problem was, that the Cube is not created. Creation via the SQL run through without any error. When opening the objects in the Database Explorer, you see two entries for each Calculation View with the same name, one in Column Views and one in Cube. The one in Cube is missing for my SQL based Calculation View.

MustafaBensan
Active Contributor
0 Kudos

frank.albrecht,

To add further context to yoganandamuthaiah's feedback, creating Calculation Views with HANA SQL used to be a feature known as "Scripted Calculation Views" and has been deprecated in favour of Graphical Calculation Views as described in Convert Script-based Calculation Views to Graphical Calculation Views. If you still need some form of scripting logic then you can create Table Functions and access them in Graphical Calculation Views as described in Table Functions in SAP HANA – step by step guide.

Regards,

Mustafa.

junwu
Active Contributor
0 Kudos

that is called table function, I think.

MustafaBensan
Active Contributor
0 Kudos

Hi jun.wu5,

I guess you mean the use of table functions for cases where graphical calculation view modelling doesn't address requirements, as described in this discussion.

Regards,

Mustafa.

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

frank.albrecht

No, it is not possible to create a Calculation View using HANA SQL. Calculation Views are created using graphical tools in the SAP HANA Modeler perspective of the SAP HANA Studio.


No, SQL statements such as CREATE CALCULATION SCENARIO are not supported. Calculation views can only be created using the SAP HANA Studio or the SAP HANA Web-based Development Workbench.

If this response answers your query, please accept it and close the thread 🙂
Have a wonderful day!

MustafaBensan
Active Contributor

What about using Business Application Studio to model Calculation Views?

yogananda
Product and Topic Expert
Product and Topic Expert

yes mbensan, through SAP BAS works as well !