This document provides a starting point for experienced HANA modelers switching from development with HANA Studio or XS Classic Workbench to development based on the HDI concepts with Web IDE. The document provides an overview of the most important changes regarding the creation of HANA Calculation Views and outlines core aspects of developing HANA models in the new Web IDE.
Functional differences between modeling Calculation Views in Studio and Web IDE
The following XS Classic Calculation View features are no longer available:
Translation of descriptions (replaced by properties file):
The following features have been adjusted for XSA/HDI (XSA Web IDE) (see also here):
- Currency and unit conversion
Models that were created in SAP HANA Studio already had the option to generate a currency column during currency conversion. This column could have been named like <base_column_name>.currency. In the Modeler of SAP Web IDE for SAP HANA this separation by “.” is not possible anymore for newly created models. You will have the option to use e.g., “_” as a separator, though. However, for migrated models the “.” separation is kept so you do not have to adapt your queries.
- Pruning tables
- No schema reference anymore, has to be modeled via synonyms
- No XML-based Analytical Privileges anymore
- No “applies to all HANA Information Models” anymore, secured Calculation Views have to be listed explicitly
- No script-based Calculation View
- SQL script to be modeled in table function which can then be used in graphically modeled Calculation View
- only possible in expressions (no “direct” column filter anymore)
- Explicit modeling of client columns.
- For testing you might want to set the session client of data preview sessions. You can do so when adding your hdi-container in database explorer using the “Advanced Options” in the dialog:
- Different query behavior on Calculation Views
See SAP Note 2647957 – Changes to Default Node behavior of old repository Calculation Views in HDI Calculation Views that are relevant in reporting scenarios
- Calculation Views are the only view modeling entities (no Attribute, no Analytic Views)
- “Calculate Before Aggregation” has to be explicitly modeled with an additional node (see Note 2658296 – Error message “Attribute is missing in node Projection” due to inconsistent modeling when migrating Analytic View to Calculation View)
Starting HANA Modeling in Web IDE
Web IDE wizards
The Web IDE offers various wizards to guide the developer though the basic steps of a project creation. The availability and functionality of those wizards however depends on the Web IDE version. This document outlines the basic steps of a Web IDE project creation to help modelers and developers reach a better understanding of the basic components and how they interact with each other.
Create a project
The Web IDE project creation of type “HANA Database Application” or “Multi-Target Application” starts with a project name and the assignment of an XSA development space. A project contains your development objects and is per default isolated from other projects. The project name can be chosen freely within the range of permitted characters and per default will be part of the service and application names that are generated when the project’s modules are deployed. The availability of development spaces depends on the setting in the XSA administration (see e.g., post-installation tasks). Different development spaces may point to different HANA database tenants. You can think about a space as a common environment in which developers share resources. This means if developers should not be able to access the same tables they should work in separate spaces.
Add a database module
Recent versions of Web IDE automatically create a database module along with the project, for older versions it has to be added manually. This module is needed to deploy your developed artifacts to the SAP HANA database. The module will be added as sub folder to the project. A usual naming convention is “db”. After its creation the database module will contain the following files and sub folders:
- json: Generated file with technical dependencies. Usually a developer doesn’t have to modify this file.
- .che: Sub folder with Web IDE project information.
- src: This is the main folder for the development of database artifacts like tables or views. As in XS Classic Repository those artifacts are technically defined in files (usually in JSON or XML format). Similar to HANA Studio the XSA Web IDE offers graphical editors for the most common artifact types (e.g. Calculation Views). A full reference of the artifact file types and their syntax can be found in the HDI Artifact Types and Build Plugins Reference. You create your views in this folder or in subfolders.
- src/.hdinamespace: This file defines the technical name space for database artifacts within the database module. It may have to be created manually. The syntax is described in The HDI Name-Space Configuration File. This file defines the initial name space and whether sub folder names should be included in the name space. It is good to choose the intended namespace at the beginning and not change it after objects have been developed. Otherwise the objects names would need to be adapted. You might also simply choose to keep the namespace empty.
- src/.hdiconfig: Generated file with the technical database artifact plugin references. Usually a developer doesn’t have to modify this file. One use-case might be that the database has been upgraded and you want to make use of the new features. Then you can increase the version in the .hdiconfig file and thus make the new features available to your project (don’t forget to build the file).
The mta.yaml file
The mta.yaml file defines the project modules and their dependencies. At this point in the project creation and development process the module and resource names associated with the project’s database module are probably something generic like “db” or “hdi_db”. Those will also be the application and service names once the project is deployed productively, so it’s a good idea to adjust those names to something more meaningful and which includes additional identifiers. For example:
- Module name “db” changed to “test_project_1-db”
- Resource name “db_hdi” changed to “test_project_1-hdi”
Further details about the mta.yaml file, its syntax and its purpose and functions can be found e.g. in Create a Simple “Tiny-World” Application.
Building the database module
Once the database module has been set up it can be built by right-clicking on the module folder and choosing “Build”. If it is the first build it will generate a new HDI container on the target database, this HDI container will be connected to a corresponding service that is references as resource in the mta.yaml file. For database module built from the Web IDE the HDI container and database schema name is usually generated and derived from the project name. This can be overridden in the mta.yaml file which lets the developer define a specific name for the database schema (see Build an HDB Module).
Any module or application deployed from XSA Web IDE can be considered temporary and non-productive, which is reflected by the generated technical names for XSA applications and services linked to the individual modules of the project. For a productive deployment the whole project must be built by right-clicking on the project itself and choosing “Build”. A successful build automatically creates an archive which can be deployed separately, for example with the XSA command line client. The names of applications and services generated during this deployment will then be exactly as specified in the mta.yaml file.
Access to the database module’s HDI container
The HDI containers linked with database modules created from Web IDE are available via right-click on the database module folder and choosing “Open HDI Container” (after the module has been built at least once successfully). Right-clicking on the HDI container in the Database Explorer shows two options to open an SQL console:
- “Open SQL Console”: Opens an SQL console with a user that is authorized to consume the generated DB artifacts. This user has a standard set of SQL privileges (SELECT, EXECUTE etc.) on the HDI container’s database schema.
- “Open SQL Console (Admin): Opens an SQL console with a user that is authorized to use the HDI container’s SQL API (see The SQL API for SAP HANA Deployment Infrastructure (HDI) (HANA 2 SP3)). By using this API other users can be granted roles of and privileges on the HDI container:
Using external database objects
Due to the main concepts of HDI external resources like tables or views in other database schemas or projects cannot be accessed directly (e.g. as sources in a Calculation View). The only way to use those external resources is by creating local synonyms in the project’s database module that point to those resources. Further details and explanations on this topic can be found in Using Synonyms to Access External Schemas and Objects in XS Advanced (HANA 2 SP3) and Synonyms in HANA XS Advanced, Introduction.
See https://developers.sap.com/tutorials/xsa-create-user-provided-anonymous-service.html for a description how most of the steps can be done by a graphical wizard.
Visibility of development artifacts
From modeling in HANA Studio you are probably used to see development objects of other developers. Due to the high isolation mode when working in Web IDE the different developers are using separate workspaces. To share development artifacts Git can be used.
Answers to some frequently asked questions around Modeling in Web IDE can be found here.
Further links – Moving Calculation View Modeling into the new development environment
Graphical Modeling View Migration (CalcView Migration Guide) (Help Portal document)
Note 2325817 – Migration of Analytic, Attribute and Script based Calculation Views to Graphical Calculation Views
Note 2618790 – Graphical View Modeling in SAP HANA – How to Avoid Unexpected Results
Further links – Web IDE development
Example of access to external schemas (in context of SAP HANA Service)
Provide an Export to SAP Support: SAP Note 2756364