Share on social networks!

How to create a CDS View in SAP HANA

Introduction to CDS Views in SAP HANA

With the arrival of SAP HANA, data management has evolved significantly. Now, instead of processing filtered data on the ABAP server (bottom-up), the recommendation is to perform extraction, transformation, and calculation directly in the database (top-down).

Core Data Services (CDS) allow you to improve performance and optimize data queries in SAP environments. This guide will explain how to create a CDS view in SAP HANA using Eclipse and the ADT plugin.

image 8

What is a CDS View in SAP?

A CDS View in SAP is an advanced data query structure that allows you to define views directly in the database, optimizing performance and facilitating integration with other SAP modules.

Main benefits of using CDS Views in SAP HANA:

  • Improves performance by running queries directly against the database.
  • Reduces the load on the ABAP server.
  • Allows data to be reused in multiple scenarios.
  • Facilitates integration with other SAP analytical tools.

Creating the CDS using Eclipse

To create a CDS view in SAP HANA, the Eclipse development environment with ADT (ABAP Development Tools) will be used.

Step 1: Open the Creation Wizard in Eclipse

  1. In Eclipse, select:
    • File → New → Other
image 9

2. The creation wizard will open. Write “Data Definition” in the search bar and select the corresponding object.

CDS

3. Click “Next” to continue.

Step 2: Define the CDS View

Now we'll need to provide the view name, a description, and the package we want to save it in. We'll use SAP's $TMP package, as we don't want to transport it to another environment.

CDS

We press Next and we enter the information for the transport (as long as we have not selected the SAP temporary package).

CDS

We continue pressing Next, and we choose the template we want to use to help us create.

In our case, since it is an Abap version higher than 7.57, it will be Define View Entity.

image 13

We click on Finish, and what is needed to begin creating the view is retrieved.

image 14

Also in the Eclipse project explorer.

image 15

Including logic in the CDS View

Once the view is created, the logic for retrieving the data is defined.

Since this is a simple example, we will only retrieve information from several fields in the SAP sales order header table.

We indicate the table on which we will perform the select (vbak) and the fields we want to retrieve (vbeln, vkorg, vtweg, waerk and netwr). We define the first of them as key.

SAP

Preview of the CDS View in SAP HANA

Selecting the preview activates the wizard again, giving us the option to select the columns to display and introduce filters into the visualization.

Step 1: Open the Data Preview

  1. Right click on the created view.
  2. Select “Open With” → “Data Preview”.
SAP

Step 2: Select Columns and Apply Filters

  1. Select the columns you want to display.
  2. Apply filters based on search criteria.
  3. Click “Open Data Preview” to retrieve data from SAP HANA.
image 18

Now we visualize the information we have indicated in our view from the Hana database.

image 19

Advantages of using CDS Views in SAP

Core Data Services (CDS) optimizes data queries in SAP HANA, reducing server load and improving system performance.

Its main advantages include:

  • Greater efficiency in data processing.
  • Reduction of query execution time.
  • Ease of code reuse and maintenance.

Implementing CDS views in SAP facilitates more efficient and structured access to data, promoting process optimization in organizations.

Learn much more at EIP International Business School. Find out everything on our blog and get trained in SAP with our cOfficial Sap S/4Hana Finance certificate.

Leave a comment

EIP International Business School informs you that the data in this form will be processed by Mainjobs Internacional Educativa y Tecnológica, SAU as the party responsible for this website. The purpose of collecting and processing personal data is to manage your subscription to the newsletter as well as to send commercial information about the services of the data controller. The legitimacy is the explicit consent of the interested party. Data will not be transferred to third parties, except under legal obligation. You may exercise your rights of access, rectification, limitation and deletion of data at compliance@grupomainjobs.com, as well as the right to lodge a complaint with the supervisory authority. You can consult additional and detailed information on Data Protection in the Privacy Policy that you will find on our website.