Sneak peek into HANA as a Service: Database artifacts and Calculation Views
SAP TechEd 2018 is just around the corner! I’ve been getting everything ready for my session on SAP Cloud Platform, SAP HANA Service and wanted to share a sneak peek of it.
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.
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
We could use the new CAP 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 them (compared to the currently available one in HANA Express).
Creating a Database Module Automagically
Please, remove that namespace, you don’t need it and only makes names longer:
You need to enable the plugins for Web IDE for the database explorer and other fun stuff if you haven’t already:
I will change things a little bit from those tutorials and create a different data model. My single table (.hdbtable) will be called JOBS.
If you want something similar to follow along, here is another tutorial that will also explain how to create the calculation view.
Fast forwarding, I am also loading data with a CSV file and an hdbtabledata configuration.
If I build the module, I get a table with data in the database explorer:
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):
(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:
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:
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 (and physical schema, which it also created for you).
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 modelling and haven’t tried it yet, here are some more step-by-step tutorials.
Those include more fancy tricks like a Star Join and Currency Conversion (something I would have killed for back in the HANA Studio days).
Ta-da! Calculation views and the whole enchilada in your SAP HANA Service!
Easy, eh? So what if you wanted to expose this through OData?
Well, you just do! I might explain that in a next blog post.
In the meantime, if you do not have such an instance but are willing to learn HANA, remember there is a free alternative with SAP HANA, express edition.
All of the tutorials I mentioned here were created for and in HXE.
Looking forward to meeting you in person at SAP TechEd 2018. Remember to add the session on your First Steps with HANA as a Service to your Agenda if you want to play with the service yourself.