Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
pallab_haldar
Active Participant
0 Kudos
In this blog I will discuss about the development lifecycle process and steps of develop an calculation view in HANA 2.0 XSA environment using Web IDE.

In HANA 1.0 till SPS12 we have developed Calculation view with the catalog object tables from a schema also the operation available for development like Join, Union is very less.

In HANA 2.0 XSA environment using web IDE we will get more operation option like Non-Equi Join, Graph, Rank, Rank, Hierarchy Function, Anonymization etc. which are not  available in HANA studio. Those option any body can easily adopt and use in their view development. I will not discuss this in my blog.

Before going to the detail steps let's have a look about the new operations available in the WEB IDE -

  1. INTERSECT

  2. MINUS 

  3. Non Equi Jon

  4. Rank.

  5. Table Function

  6. Hierarchy Function.



The important node is Table Function node. In HANA 1.0 Table function used in  Projection or Aggregation as a data source., but not as a direct node itself. But here you have a separate node.

The  data source of table function node can be a projection or aggregation or direct table or CV or another Table function itself. It is useful when  output of a node is used as data source to a Table function.

 

My objective of this blog is to discuss the part which is the critical one, i.e. using data or table from same HDI container, from different or cross HDI container or from XS classic schema. When I started my development activity initially 2 year before in XSA environment using web IDE this cross contains access troubles me lot. I want to create a smoother path to the the developer or modeler to avoid mistakes and optimize time using my blog which is the main goal.

Please find the process below -

## Prerequisite Steps:


This prerequisite will help you to develop calculation view in optimize way without any mistake.

1.Create an MTA project : First we need to create an MTA project in our workspace using Web IDE.



2. Create a DB Module : Create a DB module inside the MTA project.

 



 

 

3.Identify the tables: Identify all the tables one by one.

4.Tables exists in the same HDI container :  If all the identified tables exists in the same HDI container then no action needed.

5.Tables exists in the Different  HDI container in Same server Instance:

Please find the below steps :

A. Add the source table (Suppose T1) DB which deployed in different HDI container as a depended of a target DB  in MTA.YAML file where we will create the Calculation view and use the source table T1 .

Note : while creating the source DB please provide a key and service while adding in the MTA files.

Source DB definition :

 
  - name: source_db
type: hdb
path: source_db
requires:
- name: hdi_source_db
properties:
TARGET_CONTAINER: '~{source-container-name}'
resources:
- name: hdi_source_db
parameters:
service-name: ${default-container-name}
properties:
source-container-name: '${service-name}'
type: com.sap.xs.hdi-container

 
modules:
- name: trgt_db
type: hdb
path: trgt_db

requires:
- name: hdi_source_db
group: CROSS_CONTAINER
properties:
key: hdi-source-service
service: '~{source-container-name}'

- name: hdi_source_db
parameters:
service-name: ${default-container-name}
properties:
source-container-name: '${service-name}'
type: com.sap.xs.hdi-container

 

Same thing you can achieve via MTA graphical editor -

@Source DB :


 

@Target DB :


and then create the below hdbrole
role1#.hdbrole
----------------
{
"role":
{
"name": "role1#",
"object_privileges": [
{
"name": "TRGT_DB",
"type":"TABLE",
"privileges_with_grant_option": ["SELECT"]
}
]
}
}


role.hdbrole
------------------
{
"role":
{
"name": "role",
"schema_privileges": [
{
"privileges": ["SELECT METADATA"]
}
]
}
}

-

 

 

 

B. Create a  .hdbgrants  file  inside cfg folder (configuration) :

create a .hdbgrants configuration file inside your MTA project under DB module src package. The code should be similar like the below in which you need to changed the role name as per the role mentioned in the .hdbrole configuration file of the required table's source HDI container.

 
***********************************
targetuser.hdbgrants:
***********************************
{
"hdi-source-service": {
"object_owner": {
"container_roles":["role1#"]
},
"application_user": {
"container_roles":["role"]
}
}
}

 

C.  Create a Synonym inside src folder with below code example -

 
***************************************
targetuser.hdbsynonym
***************************************

{
"targetuser": {
"target": {
"object": "surce_db::employee"
}
}
}

Note : "source_db::employee" is the calculation view we have created in the source Database.

D. Create a targetuser.hdbsynonymconfig  file  inside cfg folder (configuration) :

 
*****************************************
File targetuser.hdbsynonymconfig
*****************************************

{
"targetuser": {
"target": {
"object": "source_db::employee",
"grantor": "hdi-source-service"
}
}
}

E. Build the MTA application  and create a calculation view and consume the employee table and you will be able to see the employee data.

 


 

6.Table exists in a XS classic schema or Outside the HANA Server Instance with HDI : Add the Source XS Classic schema or Outside the HANA Server Instance as a user-provided service to the target database where we will create the Calculation view.

# For different HANA Server Instance with HDI :

Please find the below steps :

A. Add the User defined service as a depended of a target DB  in MTA.YAML file where we will create the Calculation view and use the source table T1  from the user define service.

 

 


 
modules:
- name: trgt_db
type: hdb
path: trgt_db

requires:
- name: cross-service
group: CROSS_CONTAINER
properties:
key: Service_test
service: '~{cross-service-service}'


resources:
- name: cross-service
parameters:
service-name: technodb-service-container
properties:
cross-service-service: '${service-name}'
type: org.cloudfoundry.existing-service

 

Same thing you can achieve via MTA graphical editor -

@Target DB :


 

 

B. Create a  .hdbgrants  file  inside cfg folder (configuration) :

create a .hdbgrants configuration file inside your MTA project under DB module src package. The code should be similar like the below in which you need to changed the role name as per the role mentioned in the .hdbrole configuration file of the required table's source HDI container.

 
***********************************
targetuser.hdbgrants:
***********************************
{
"Service_test": {
"object_owner": {
"container_roles":["role1#"]
},
"application_user": {
"container_roles":["role"]
}
}
}

 

C.  Create a Synonym inside src folder with below code example -

 
***************************************
targetuser.hdbsynonym
***************************************

{
"source_db_emp_cv": {
"target": {
"object": "surce_db::employee"
}
}
}

Note : "source_db::employee" is the calculation view we have created in the source Database.

D. Create a targetuser.hdbsynonymconfig  file  inside cfg folder (configuration) :

 
*****************************************
File targetuser.hdbsynonymconfig
*****************************************

{
"targetuser": {
"target": {
"object": "source_db::employee",
"grantor": "Service_test"
}
}
}

E. Build the MTA application  and create a calculation view and consume the employee table and you will be able to see the employee data.

 

# For Table exists in classic HANA Schema in different HANA Server :

Please find the below steps :

A. Add the User defined service as a depended of a target DB  in MTA.YAML file where we will create the Calculation view and use the source table T1  from the user define service. select Non HDI container.

 


 
modules:
- name: trgt_db
type: hdb
path: trgt_db

requires:
- name: cross-service
group: CROSS_CONTAINER
properties:
key: classic_schema_service
service: '~{cross-schema-service}'


resources:
- name: cross-service
parameters:
service-name: plb_schema
properties:
cross-schema-service: '${service-name}'
type: org.cloudfoundry.existing-service

 

 

 

B. Create a  .hdbgrants  file  inside cfg folder (configuration) :

create a .hdbgrants configuration file inside your MTA project under DB module src package. The code should be similar like the below in which you need to changed the role name as per the role mentioned in the .hdbrole configuration file of the required table's source HDI container.

 
***********************************
targetuser.hdbgrants:
***********************************
{
"Employee_table_grantor": {
"object_owner": {
"schema_roles": [
"roles": ["PLB_SCHEMA::role1#"]
]
},
"application_user": {
"schema_roles": [
"roles": ["PLB_SCHEMA::role1"]
]
}
}
}

 

C.  Create a Synonym inside src folder with below code example -

 
***************************************
targetuser.hdbsynonym
***************************************

{
"targetuser": {
"target": {
"object": "employee"
"schema": "PLB_SCHEMA"
}
}
}

 

E. Build the MTA application  and create a calculation view and consume the employee table and you will be able to see the employee data.

## Main Steps to create Calculation view -


1.Create a calculation view : Create a view from the wizard.


 



2.  Now we are in the workspace pane and added  join node.


 

3. Add data source. then the popup will be open from there select the external service to choose the source. This step will apply both for Different HDI and XS Classic schema scenario.

4. Go to the database container and data preview the CV. you can see the data.

Hope my blog will help to develop Calculation view in a very smooth way in different container scenario...…..
Labels in this area