Thursday, 13 September 2018

Sneak peek into HANA as a Service: Database artifacts and Calculation Views

If you are lucky to come to TechEd, I have plenty of instances to share for you to configure and deploy yourself. We will be using the Cloud Application Programming model to build a little something on top of them.

Setting the SAP HANA service up


In the meantime, here’s an overview of how to create some database artifacts, including a Calculation View with K anonymization, in your instance from SAP Web IDE Full Stack.


SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

Philip Mugglestone already published great video tutorials on how to deploy your instance and connect to it. If you can’t see the option to create the service, remember that as of today, this is not available through trial.

This instance of mine has been created with the scriptserver option on:


Getting an MTA up and running


At TechEd, I will be using the new Cloud Application Model to build an app but the good ol’  MTA wizard also does the trick.

There are only minor differences with the already documented XSA path. After all, XS Advanced is our HANA-friendly, on-premise version of Cloud Foundry.

Most of these differences come from using SAP Web IDE for Full Stack as opposed to SAP Web IDE for HANA. Again, these are minor and this wizard to create an MTA and a DB module altogether is one of these differences (compared to the currently available one in HANA Express).

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

Creating a Database Module Automagically


Please, remove that namespace, you don’t need it and only makes names longer:

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

You do need to enable the plugins for Web IDE for the database explorer and other fun stuff if you haven’t already:

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

I will change things a little bit from those tutorials and create a different data model. My single table will be called JOBS:

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

Fast forwarding, I am also loading data  with a CSV file and an hdbtabledata configuration. If you want something similar, here is another tutorial that will also explain how to create the calculation view.

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

If I build the module, I get a table with data in the database explorer:

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

Errors, anyone?


If you get an error when building the module, make sure the space is set in your cloud Foundry options or the project settings. And of course, having a service of type “hana” in that same space is super important, otherwise, Web IDE will have nothing to bind to.

You could also get an error for having more than one HANA service in the same space (lucky you!). Use parameter “database-id” and the GUID for your database (you can find this at the Database Cockpit):

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

(What on earth are) HDI Containers


When you build the module, Web IDE will also create an HDI container for you.

You could manually create the HDI container using the Command Line Interface or with this graphical option here:

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

But there is no need because Web IDE created it for you. If you click on that tile, you will see the instance of the service:

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

If you list the services using the CLI, you will also see the HDI container, which also translates to a schema with vitamins. So why do you see it as a service? How is it both a schema and a service?

Because this service will manage the database artifacts for you. It will have its own technical user that will access the actual physical database. In other words, you only have to worry about creating the design time artifacts, like the hdbtable. The technical user that gets created automatically with your container will use its authorizations and super power to execute the actual “CREATE TABLE” statement in actual physical schema.

Let’s try everyone’s favorites: Calculation Views!


Also with a twist, using an intuitive form of anonymization. If you want to create your own and haven’t tried it yet, here are some step-by-step tutorials including more fancy stuff like a Star Join and Currency Conversion (something I would have killed for back in the HANA Studio days).

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

Ta-da! Calculation views and the whole enchilada in your SAP HANA Service!

SAP HANA Certification, SAP HANA Database, SAP HANA Study Materials, SAP HANA Calculation Views

No comments:

Post a Comment