Developing Applications Running on SAP BTP Using SAP HANA Cloud

Introducing Core Data Services

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

After completing this lesson, you will be able to:

  • Explain the basic concepts of Core Data Services

Introducing Core Data Services

Core Data Services - Data definition Language

Core Data Services - Data definition Language

Below are few concepts from Domain Modelling that we will be using in the subsequent chapters for a complete, reference – Please refer to https://cap.cloud.sap/docs/

  • Namespace :

    are used to help getting to unique names , this helps to keep the code clean by avoiding fully qualified names.

  • Entities :

    represent data that can be read and written by consumers, uniquely identified by their primary keys.

    For Example, Products and Suppliers are defined as Entities

  • Types :

    describe the types of elements within entities.

    Various built-in types are provided. For example Integer, Decimal and UUID as seen in the screen shot – UUID are autogenerated ID’s

  • Associations :

    capture relationships between entities.

    For example, Entity Products is Associated with Entity Supplier

  • Compositions :

    are used to model document structures through "contained-in" relationships.

    For example, in the definition of Suppliers, the Products composition refers to the Products entity.

    In this case 1 supplier can provide multiple products but 1 product will only have 1 unique supplier.

Table Creation Process

Table Creation Process

Core Data Services (CDS) is a technique used to create the persistency layer (the database layer) of a software application.

During software development the data model is defined via a Data Definition Language within a file with extension .cds.

When the application is built and then deployed, a set of database tables is generated in the database reproducing the data structure described in the file.

If the .cds file is modified and the program is re-built, the created database objects are automatically changed to realize the new model.

Example of .cds file

Example of .cds file

The figure above is an example of a .cds file, created in the SAP Business Application Studio .

The Created table

The figure above shows the created database tables that you can display with the Database Explorer.

Create table statement

The figure above shows the created the table definition as created during deployment to the database this can be checked with the Database Explorer.

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