CDS Views – Introduction

This blog will provide general information about Core Data Services and CDS Views.

 CDS Views – Introduction
As we know, SAP HANA is more than a database system. For this reason, some changes are needed in the programming approach in order to fully benefit from the advantages offered by the SAP HANA system with the developing technology. The trick of HANA is in terms of data processing, direct access to database and network etc. to make processing faster. It eliminates the delays that can occur due to reasons such as Data-intensive operations can be performed at the database layer itself, using the Code to Data paradigm.
 
The Code to Data approach reduces system density, increases computational speeds, and reduces the movement of data from one layer to another. Core Data Services is a method for Code Push Down. Generally, where local execution is desired, Open SQL is the first tool for ABAP developers to reduce heavy data processing to the database layer, but Core Data Services should be used later if data models or features such as Union, Association need to be reused.
 
Core Data Services is a collection of domain-specific languages (DSLs) and services for defining and using semantically rich data models. Entity definitions and semantic relationships between entities can be developed using CDS. CDS artifacts are stored as DDIC objects, can be used in ABAP programs, and can be used as a source/destination for DML Expressions. DDL resources and CDS assets are managed by ABAP, so the entire lifecycle of CDS assets is controlled by the ABAP Change and Transport System (CTS).
 
Items and structures that can be created using CDS include:
 
  • View
  • Tables (Entities)
  • Associations
  • Annotations
  • User Defined data types
  • Contexts
Meta models of an application that requires Code Push Down can be created using CDS Views. A CDS view is more powerful than the SE11 view as it defines an open source DDL for creating a metamodel repository containing database tables, database views, functions and data types. Since the view we created uses the Code Push Down method, its performance will be much better because it processes directly on the database layer. There are two types, ABAP CDS views and HANA CDS views. ABAP CDS Views is database independent, while HANA CDS Views is database dependent. CDS objects created using HANA CDS are not controlled by the ABAP dictionary and therefore cannot be used in ABAP Programs or Open SQL. HANA CDS requires the entity type definition for the DDIC table, whereas ABAP CDS does not require it and thus it is prevented from being copied at the CDS layer.
 
CDS Views is a way to be used frequently in the future, and all content transmitted within SAP is gradually transferred to CDS views.
 
Let's create a CDS View with a JOIN with a simple example. The steps we will follow are as follows:
 
  1. We are adding a new content to the project we created using ADT (ABAP Development Tool) over Eclipse.
  2. We define the view we will create. Here is where we need to pay attention: The definition we enter in the Name section will be the DDL source that appears when we view the view from SE11.
  3. After completing the definition and selecting request, we are asked whether we will use any template on the screen that opens. For this example, let's choose the Define View with Join option
    1. .
  4. Let's write our query. Let's save and activate.
 Text Box: @AbapCatalog.sqlViewName: 'ZXSPRO_CDS_V001' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'Material Information' define view ZXSPRO_CDS_V_001 as select from mara left outer join makt on mara.matnr = makt.matnr left outer join mard on mara.matnr = mard.matnr { mara.matnr as MaterialNumber, mard.werks as ProductionPlace, mard.lgort as Warehouse, makt.maktx as MaterialDescription, mara.ersda as MaterialCreationDate, mara.ernam as MaterialCreator, mara.mtart as MaterialTour, mara.matkl as MalGroup }
 
The issue I want to mention here is the equivalent of ZXSPRO_CDS_V_001 DDL source, which we entered in the definition section, as I just mentioned, and ZXSPRO_CDS_V001 is the equivalent of DDL SQL view. Let's examine the view we created from the SE11 transaction code.
Let's take a look at the objects we created using ADT.
Finally, let's see what output this view will give when we run it.