Developing Applications Running on SAP BTP Using SAP HANA Cloud

Introducing the SAP HANA Database Module

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Describe the main features of the SAP HANA Database module

Introducing the SAP HANA Database module

Watch this video to learn about the runtime structure of the full-stack application.

Runtime Structure of the Full-Stack Application

At runtime, the full-stack MTA is commonly made in the following way:

  1. The user interface is written using HTML5 and rendered/executed in a web browser.
  2. The HTML5 program communicates with the router via the HTTP protocol. The router is a program running on the server. It does not execute business logic, it is just a dispatcher of HTTP messages.
  3. The router dispatches the HTTP message to the proper application, running on the server. This application is built out of the corresponding Node.js (Java, Python, and so on) module, coded by the developer within the MTA project in the Business Application Studio.
  4. The Node.js application communicates with the database via an SAP HANA service, that is connected to an SAP HANA Deployment Infrastructure (HDI) container stored in the database.
  5. Database objects (Tables, Views, Procedures, and so on) are stored in the HDI container.
  6. The procedures in the database use the SQLScript (alternatively the R) language, that is specialized in highly parallel and data intensive processing.
The SAP HANA Database Module

The SAP HANA Database Module

At design time, in the SAP Business Application Studio, an MTA project is created.

The database content of the MTA is defined using the db folder also called as SAP HANA database module.

This module contains the design time definitions of all the objects to be created in the database, for example:

  • Domain Models (Persistence).cds
  • Tables and Views(.hdbtable and .hdbview)
  • Calculation Views(.hdbcalculationview)
  • Procedures (.hdbprocedure)
Note
The HANA components have to be selected during the creation of the CAP project alternatively they can be added later. This components are required to be able to create the HANA Native Artifacts. In addition additional configuration is required to enable the development of Native HANA Artifacts.
Database Folder of CAP Project

Database Folder of CAP Project

A minimal SAP HANA database module contains:

An src folder, made to store the design time definitions of the database objects.

A package.json file for configuration for the MTA project is required for example, to set the version and the options of the deploy program. In case of CAP projects this file is shared by all three modules.

Additionally datafolder is required in case the data has to be provided by files (.csv). The system identifies the files based on its placement under datafolder under dbfolder and generates the .hdbtabledata files for deployment.

SAP HANA Cloud service instance

SAP HANA Cloud service instance

A service of type HANA (technical name com.sap.xs.hdi-container) needs to exist for the HDI container to be accessible from Cloud Foundry. When you create a new SAP HANA database module, a service is also added by default to the mta.yaml file, together with the configuration required for the service to be accessible by the module.

When the module is built, a service instance (of type HANA) is created in Cloud Foundry. This service instance is connected to the HDI container that is created in the SAP HANA database.

Using the Hidden Configuration Files in the SAP HANA Database Module

.hdiconfig

.hdiconfig

The database artifact .hdiconfig specifies the plug-ins and the version to use when deploying a particular type of database artifact to an HDI container. The artifact type is defined in the file suffix, for example, .hdbcds or .hdbsynonym. The plug-in definition ensures that the appropriate runtime object is created from the specified design time artifact.

.hdinamespace

.hdinamespace

In SAP HANA HDI, name-space rules are defined in one or more file resources named .hdinamespace. The file resources must be located in the design time folder to which the naming rules apply, or the root folder of a hierarchy to which the naming rules apply. The content of the .hdinamespace file is specified according to the JSON format.

You can change the path defined in the name and, for the sub-folder, you can choose between append (add sub-folder name to object name space) and ignore (do not add sub-folder name to the object name space).

Note
This concept will be used when working with the HANA Native Artifacts. In case of .cds we define the namespace within the file.

Save progress to your learning plan by logging in or creating an account