Skip to Content
Technical Articles
Author's profile photo Denys van Kempen

Getting Started with SAP HANA Cloud | Cloud Foundry Advanced

With this blog series we provide an update with the latest information on getting started with SAP HANA Cloud on the SAP Cloud Platform.

  1. About SAP HANA Cloud
  2. SAP HANA Cloud Getting Started
  3. SAP HANA Cloud and SAP Business Application Studio
  4. HDI with SAP HANA Cloud
  5. SAP Analysis for Microsoft Office and SAP HANA Cloud
  6. Cloud Foundry Advanced <=
  7. SAP HANA Cloud, JWT Provider, and Certificate Collection with Purpose JWT
  8. Data masking and data anonymization
  9. Predictive Analysis Library (PAL) and Automated Predictive Library (APL)
  10. Remote data sources and virtual tables
  11. OData with SAP HANA Cloud
  12. SAP HANA Cloud Graph
  13. Role Attributes
  14. SAP HANA Cloud and Smart Data Integration

For more information about the free trial, see

For the new features overview posts, see

Questions? Post as comment.

Useful? Give us a like and share on social media.

Thanks!

/wp-content/uploads/2016/02/sapnwabline_885687.png

Hands-On Video Tutorials

Chief partner engineer, Philip MUGGLESTONE just updated his SAP HANA Cloud playlist on the SAP HANA Academy YouTube channel with three short new videos covering space travel for SAP HANA Cloud instances or instance sharing, how to handle multiple instances in a single space, and to define explicit schema names for HDI containers.

In this blog, you will find the videos embedded with some additional information and resources.

You can watch the four video tutorials in about 30 minutes. What you get back is

  • How to access an SAP HANA Cloud instance from a different Cloud Foundry spaces and/or orgs
  • How to set the database ID of an SAP HANA Cloud instance when creating HDI container service instances
  • How to explicitly set the schema name when creating HDI container service instances
  • How to set the SAP HANA Cloud database ID and/or schema when creating multi-target applications
  • How to configure intra-HDI container access (from one container to another container)

We created the SAP HANA Cloud instance and explained how to work with HDI containers and the SAP Business Application Studio in the previous blogs, so make sure to read these first. To bookmark the playlist on YouTube, go to > SAP HANA Cloud

Ready for lift-off?

/wp-content/uploads/2016/02/sapnwabline_885687.png

Instance Sharing

In this tutorial, we discover how to access an SAP HANA Cloud instance from another Cloud Foundry space or organisation.

To access an SAP HANA Cloud instance from another Cloud Foundry space or even organisation, we need to create a mapping for the instance to the relevant Org and Space ID.

Across organisations, the cloud provider and region needs to be the same. If no space is selected, the mapping applies to all spaces.

Subsequently, we can create, for example, an instance of SAP HANA Schemas & HDI Container service (plan: hdi-shared) in our SAP. HANA Cloud database.

For the documentation, see

/wp-content/uploads/2016/02/sapnwabline_885687.png

Multiple Instances

In this video we discover how we can use the database ID when creating an HDI service instance or MTA application in case multiple instances are running in a single Cloud Foundry space.

In case your space contains multiple SAP HANA Cloud instances, you need to specify the database ID as parameter in JSON format when creating a service instance of the HDI container.

The cf command equivalent is

# connect
cf l
# target the right space
cf t -s dev
# list the available services
cf s
# get the GUID of the service 
cf service <service_name> --guid

# target the right space
cf t -s test
# create an HDI service instance specifying GUID 
cf create-service hana hdi-shared <name> -c '{"database_id":"<GUID>"}'

On Windows, escape the double quote characters

cf create-service hana hdi-shared <name> -c '{\"database_id\":\"<GUID>\"}'

The database ID is also used used as parameter in the mta.yaml file of the db target of a multi-target application (MTA). Below an example of the configuration using the SAP Business Application Studio.

For the documentation, see

/wp-content/uploads/2016/02/sapnwabline_885687.png

Explicit Schema Names

In this video tutorial, we discover how to set the schema name of an HDI container explicitly. The alternative and default value is a unique GUID.

When creating the HDI service instance, we can specify the schema as parameter in JSON format. The schema name must be unique in the database.

The service key displays the new schema value and is also used as prefix for the design time (DT) and runtime (RT) users.

When connecting we can now use a more user-friendly identifier.

jdbc:sap://12345-6789.hana.prod-eu10.hanacloud.ondemand.com:443?
encrypt=true&validateCertificate=true
&currentschema=MYSCHEMA"

Using the command line, specify the schema as parameter in JSON format.

cf create-service hana hdi-shared <name> -c '{"schema":"MYSCHEMA"}'

When creating a multi-target application. set the parameter in the resource section for the HDI container.

/wp-content/uploads/2016/02/sapnwabline_885687.png

Configure JWT Trust

In this video tutorial, we cover how to configure the trust relationship between your Cloud Foundry subaccount and the SAP HANA Cloud instance. This is required, for example, when a Node.js application needs to access an HDI container.

Source code: github.com/saphanaacademy/SAPHANACloud/blob/master/trust.txt

[0:00] – Introduction

[0:45] – 500 Internal Server Error returned when trust is not configured

[1:00] – Log message: the predefined session variable cannot be set via SET command XS_APPLICATION USER

[1:20] – open Database Explorer. The first four queries verify no JWT configuration has been configured yet

SELECT * FROM PSES WHERE PURPOSE = 'JWT';
SELECT * FROM CERTIFICATES;
SELECT * FROM PSE_CERTIFICATES;
SELECT * FROM JWT_PROVIDERS;

[2:45] – construct the JWT trust URL

https://<subdomain>.authentication.eu10.hana.ondemand.com/sap/trust/jwt

[3:20] – create certificate

CREATE certificate FROM '-----BEGIN CERTIFICATE-(...)-END CERTIFICATE-----';
CALL SYSTEM.CREATE_JWT_PROVIDER
('JWTPROVIDER1', 
 'https://yoursubaccountdomain.authentication.<region>.hana.ondemand.com/oauth/token', 
 'user_name', true);

[3:50] – get certificate ID and create PSE

CREATE pse PSE1;
ALTER pse PSE1 ADD certificate <certificate_id>;
CALL SYSTEM.SET_PSE_PURPOSE
 ('PSE1', 'JWT', ARRAY('JWTPROVIDER1'));

[4:30] – app returns data

/wp-content/uploads/2016/02/sapnwabline_885687.png

Intra-HDI Container Access

In this video tutorial, we learn how to configure access from one HDI container to another within the same Cloud Foundry Org and Space.

The source code for this project is in the SAP HANA GitHub repository

0:40 – Use git clone to import this into SAP Business Application Studio (or your preferred IDE).

1:30 – The protagonists of this tutorial are the applications scpapps (source) and myappssyn (target) and we start with defining two design-time role definitions (.hdbrole):

  • a standard role with read access to the sales table in the container
  • a privileged role, identical to the standard but with grant option 

2:50 – Build and deploy the MTAR to your Cloud Foundry space.

3:40 – This results in an app, we can access in a browser to display data from the sales table.

4:10 – We can view the same data when we connect to the HDI container in the Database Explorer.

5:00 – The mta.yaml configuration file for our second application specifies the TARGET_CONTAINER property and references an existing service name, the name of the HDI container that was created when we deployed the myapphana app.

6:11 – The target app includes sales.hdbgrants which assigns the two roles to the technical users:

  • with-grant option (_g#) to the object owner
  • regular role to the runtime user

6:55 – The target app also includes the src/sales.hdbsynonym and cfg/sales.hdbsynonymconfig artifacts specifying myapphana as the source object.

8:15 – The query in server.js selects from the synonym.

app.get('/srv/sales', function (req, res) {
    req.db.exec('SELECT * FROM "myappsyn.db::sales"', 
    function (err, results)
   (...) }

8:30 – Build and deploy the application.

9:07 – Open the myappsyn app and view the sales data stored in the HDI container from myapphana.

9:28 – Add the HDI container from myappsyn to Database Explorer and view the sales data via the synonym.

10:00 – In case the service name (in our example myapphana-hdi) is not known when you develop the application, you can use the file mta-config.mtaext to provide this information at deploy time.

For the documentation, see the topics in the SAP HANA Developer Guide for SAP HANA XS Advanced Model

/wp-content/uploads/2016/02/sapnwabline_885687.png

Share and Connect 

Questions? Post as comment.

Useful? Give us a like and share on social media. Thanks!

If you would like to receive updates, connect with me on

For the author page of SAP Press, visit

For the SAP HANA Cloud e-bite, see

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo srinivas rallabandi
      srinivas rallabandi

      Thank you Denys.

      Author's profile photo Denys van Kempen
      Denys van Kempen
      Blog Post Author

      Thanks Philip MUGGLESTONE

      Author's profile photo Pankaj Kumar
      Pankaj Kumar

      Thank you Denys! most informative..

      Author's profile photo Ivan Mirisola
      Ivan Mirisola

      Hi Denys van Kempen,

      I've tried to use Hana Cloud Service with WebIDE by setting the HDI container parameter with database_id. I got the GUID via command line, but the deployment process is always unable to find the database id in my org/space.

      I've tried to create the hdi container manually via CLI, but I got the same error.

      Are there any additional settings in the MTA to make this work on a trial account?

      Best regards,
      Ivan

      Author's profile photo Denys van Kempen
      Denys van Kempen
      Blog Post Author

      Hi Ivan,

      [UPDATED]

      As of July 12, we now have two entitlements for HDI

      • SAP HANA schemas & HDI containers (trial): plan = hanatrial >> SAP HANA Service
      • SAP HANA schemas & HDI containers: plan = hana >> SAP HANA Cloud

       

       

       

      Author's profile photo Shiyam Raghul
      Shiyam Raghul

      Hi Denys van Kempen,

       

      When iam trying to add my HANA Cloud instance database_id while creating HDI shared containers iam receiving the following message:

      "Unable to create service instance. We are sorry, but we have encountered an internal error. If the problem persists, please create a support ticket.

      Service broker error: Service broker hana-broker-trial failed with: Can not create service instance 'SFLIGHT': There is no database with database_id 'xxxxxxxxxxxxxx' in space 'dev' within organization '7cbbca8dtrial'. Check the database_id. "
      But my Hana Cloud instance is running in the same dev space as my hdi- shared containers.
      hana%20instance%20running%20in%20dev%20space
      Thank you,
      Shiyam
      Author's profile photo Denys van Kempen
      Denys van Kempen
      Blog Post Author

      Hi Shiyam, could you try again?

      The HDI service still pointed to the HANA service, not HANA cloud. This has been corrected.

      Author's profile photo Shiyam Raghul
      Shiyam Raghul

      Hi Denys van Kempen,

      I have again tried and still it is throwing the same error, my new hdi-shared instance is not able to find my hana cloud instances, though my hana cloud instance is running on the same dev space.

      hdi%20instance%20error

       

      And also the hdi instances created by building a hana database module by selecting (hana cloud as version) is also not pointing to my hana cloud instances. I could see the host in service key of the hdi instance is still pointing to ""host": "zeus.hana.prod.us-east-1.whitney.dbaas.ondemand.com","

      I tried deleting and recreating the hana cloud instances and also tried deleting and re creating the entire trial account multiple times, but no luck.

      Thank you for the help

      shiyam

      Author's profile photo Denys van Kempen
      Denys van Kempen
      Blog Post Author

      Hi Shiyam,

      Thanks for sharing. There are currently two entitlements for HDI.

      • Add a service plan for SAP Schemas & HDI Containers
      • Create a SAP HANA Cloud instance
      • Create an instance of the SAP Schemas & HDI Containers service
      • (optionally) Create a service key - this displays the URL

      As long as the SAP HANA Service is still available there also needs to be a service for schema and HDI. It would be helpful, of course, if this was clearly indicated in the name.

      Solves your issue?

       

       

      Author's profile photo Shiyam Raghul
      Shiyam Raghul

      Hi Denys van Kempen,,

      Thank you so much for the help, now iam able to create hdi instances under my cloud instances.