SAP Analytics Cloud: Using a Calculation View from HANA in SAP Cloud Platform Trial
would like to illustrate how to connect from SAP Analytics Cloud (known before as BusinessObjects Cloud) to a Calculation View in HANA database in SAP Cloud Platform (known before as HCP) using Single Sign On. If you don’t have HANA in SAP Cloud Platform (SAPCP) but you would like to use it with your tenant, this first blog will show you how to create a user and a Calculation View to be consumed in SAP Analytics Cloud.
1. Prerequisites in SAP Cloud Platform account
I will be using a simple Trial HCP account. If you don’t have one, you can create one:
I will be creating a HANA user HCPUSER as my user account. In order to make changes on the account, I need to first login to the Web-based Development Workbench. For example, if you are using HANA in SAPCP Trial:
In order to create the account to be used later on in SAP Analytics Cloud, we will need to log in with an Admin account with these roles assigned (e.g.: SYSTEM):
sap.hana.xs.admin.roles::SAMLAdministrator sap.hana.xs.admin.roles::RuntimeConfAdministrator sap.hana.ide.roles::CatalogDeveloper sap.hana.ide.roles::SecurityAdmin
You can also connect directly using HANA tools for Eclipse and the tools for HANA on demand.
If you are using SAP HANA studio 2.0 you can install the required software adding the following URL to your list of Available Software Sites: http://tools.hana.ondemand.com/kepler
If you want to know more on how to create users, you can watch this video by the SAP HANA Academy.
2. Assigning correct roles to your new HANA account
Now that we have created our analytics account in HCP: HCPUSER, we need to assign the following role:
I illustrate how to do it directly in the same Web-based workbench as before:
If you want to use this HCPUSER in HANA Studio to create the packages and Calculation Views, you will require few other roles and granting access to _SYS_BIC. For full details you can check the documentation: HANA Security Guide.
If you try to create a package, you will get the following error:
With the SYSTEM account you will need to execute the following SQL commands:
GRANT EXECUTE ON REPOSITORY_REST to HCPUSER;
I created a package named MyPackage to be used by my user HCPUSER. If we want this user to have access to create objects there, we must also grant the following rights:
GRANT REPO.READ ON _SYS_REPO."MyPackage" TO HCPUSER; GRANT REPO.EDIT_NATIVE_OBJECTS ON _SYS_REPO."MyPackage"TO HCPUSER; GRANT REPO.ACTIVATE_NATIVE_OBJECTS ON _SYS_REPO."MyPackage" TO HCPUSER; GRANT REPO.MAINTAIN_NATIVE_PACKAGES ON _SYS_REPO."MyPackage" TO HCPUSER;
3. Creating the Calculation View in HANA studio
Now, we are ready to crate a Calculation View. If you are not familiar with HANA Studio or Calculation Views, I will recommend you to visit the Videos posted by the SAP HANA Academy.
If you get the following error when trying to activate your view:
Message : Repository: Encountered an error in repository runtime extension; Model inconsistency. Create Scenario failed: The following errors occurred: user is not authorized (2950)
In HANA the modelers are managed by the user “_SYS_REPO” that needs access to the repository used. This is going to be executed by the HCPUSER account:
GRANT SELECT ON SCHEMA <NAME_OF_THE_SCHEMA> TO _SYS_REPO WITH GRANT OPTION;
In my case <NAME_OF_THE_SCHEMA> was in fact HCPUSER which is the schema where I created my tables and uploaded my data in HCP.
The last bit is granting the user HCPUSER activating views. This has to be granted by the SYSTEM account or similar Admin account.
GRANT SELECT ON SCHEMA _SYS_BIC TO HCPUSER; GRANT SELECT ON SCHEMA _SYS_BI TO HCPUSER; CALL GRANT_ACTIVATED_ANALYTICAL_PRIVILEGE('_SYS_BI_CP_ALL','HCPUSER')
After these changes, we should be able to Activate our Calculation View and it should be ready to be used in SAP Analytics Cloud.
Note: if you don’t activate these privileges, you should get errors like this when trying to execute a Data Preview in HANA Studio:
SAP DBTech JDBC: : insufficient privilege: Not authorized
Before you are ready to use that calculation view in SAP Analytics Cloud, use Data Preview in HANA Studio with your user account (HCPUSER). You should be able to explore your data:
If you don’t have any errors, you are ready to use it in your SAP Analytics Cloud tenant.