SAP ABAP Dictionary Views vs. SAP ABAP CDS Views – What Are the Differences?

CDS Views
Two origami stars.

ABAP dictionary views or Database views are created in the SE11 in the ABAP dictionary. ABAP CDS views are created in Eclipse – for now. The guess is that sooner or later it will be possible to develop them in the Web IDE, as well.

Where an ABAP dictionary view and an ABAP CDS views get created is the first obvious difference. But first things first – what are ABAP dictionary views and what are ABAP CDS views.

ABAP Dictionary Views

ABAP dictionary views fetch pre-defined data rom the database . The ABAP dictionary views use SQL Statements to obtain from the database the data needed for an application to process the desired result.

For example, an ABAP application wants to output all products. For this, the application needs to fetch the necessary data of a product from the database. Instead of doing this directly through an SQL statement, the application uses an ABAP dictionary view.

The ABAP dictionary view gets the data of a product from the tables of the database by SQL. It connects all necessary tables of the database by Inner Joins and selects from the tables all the necessary fields for a product.

The ABAP application does not use an SQL statement directly to get the data of the product from the database, instead using ABAP dictionary view. The ABAP dictionary view is like an additional layer between the ABAP application and the database.

For example, the name of the ABAP dictionary view is ZPRODUCTS. It contains all tables and fields necessary for a product.

In the ABAP code, the ABAP dictionary view could be used like this:

SELECT * FROM zproducts 
    ORDER BY product_name 
    INTO TABLE @DATA(result). 

cl_products_output=>display( result ).

An ABAP dictionary view is a view for one or more database tables. It is literally a view. Imagine you are looking through binoculars at a database. You only focus on certain tables – or even just one table.

The same applies to ABAP dictionary views: you pick one certain table or bundle certain tables together. Plus, you also can focus on just certain fields from those chosen tables.

For example, a database contains a bunch of tables. Your application aims to return data which resides in three of the tables of the database, and only one field of each table is necessary. Here comes the view: the view connects those three tables and picks only the fields of the tables which are needed.

When you activate an ABAP dictionary view, a SQL view is created. This SQL view contains the SQL syntax of the defined ABAP dictionary view. For example, if you connect more than one table with an ABAP dictionary view, then the SQL statement of the SQL view does this by an Inner Join.

ABAP CDS Views

ABAP CDS views were introduced in ABAP 7.40 SP05. There are two variants: ABAP CDS views and HANA CDS views. They are both parts of the new programming model of SAP.

The new programming model of SAP pushes the code and therefore the logic from the application level down to the database level and up to the front-end or client-side. CDS views push the logic down to the database and up to the client-side.

Because they take logic from an ABAP application from the application server and execute it instead at the database level, CDS views allow the control of SAP UI5 Smart Controls and Fiori Elements through annotations and OData services, which delegate logic to those controls and therefore the client-side.

Before the new programming model of SAP, the concept was to fetch via pre-defined SQL statements a data package from the database and to process it at the application level to the required result. ABAP dictionary views commonly described the pre-defined SQL statements.

The new programming model does transfer the processing of the SQL-fetched data from the application level down to the database level, and it does so by CDS views.

The CDS view does not only pre-define the SQL statement but also contains the logic to process it by the SQL statement-fetched data. The aim is to do as much logic as possible at the database level by using CDS views.

In the case of ABAP CDS views, the views still reside at the application level in the Data Dictionary (SE11), but a CDS view can transfer more logic than an ABAP dictionary view from the application server to the database through SQL. Nevertheless, an ABAP CDS view still pushes the result of the SQL statement back to the application server.

In the old programming model, the principle was ‘the less database load, the better’. In the new programming model, the principle is ‘the more database load, the better’. It is about Code-to-Data and no longer Data-to-CodeCode-to-the-Database and no longer Data-from-the-Database-to-the-Code.

ABAP Dictionary Views vs. ABAP CDS Views

First, ABAP dictionary views compared to ABAP CDS views should not be confused with ABAP CDS views in comparison to HANA CDS views.

ABAP Dictionary Views

  • reside in the application server
  • support all kinds of databases
  • have limited basic SQL functions like INNER JOIN or SELECT

ABAP CDS Views

  • reside in the application server
  • support all kinds of databases
  • basic SQL functions are INNER JOIN, OUTER JOIN, UNION, or SELECT
  • perform calculations, aggregations, grouping
  • nested views

HANA CDS Views

  • integrated into the database (HANA XS)
  • support only HANA databases
  • perform all the other features of ABAP CDS Views
  • explicit features for the HANA database

5 Reasons to Use ABAP CDS Views Instead of ABAP Dictionary Views in an ECC System

There are 5 reasons to use ABAP CDS views instead of ABAP dictionary views in an ECC system:

  1. upward compatibility to S/4
  2. easy generation of full-fledged OData Services
  3. easy use of SAP UI5 Smart Controls and Fiori Elements
  4. implicit authorization checks
  5. performance boost (see below)

Performance Difference Between ABAP Dictionary Views and ABAP CDS Views

Between ABAP dictionary views in an ABAP stack with a version of at least 7.40 SP05 and CDS views, there is no performance difference. Such an ABAP stack with or without an ABAP dictionary view and an ABAP CDS view use exactly the same SQL behind the scenes.

That means the performance is the same if you execute the same SQL statement with or without an ABAP dictionary view in an ABAP Stack or through an ABAP CDS view.

However, there is a performance difference in so far as ABAP CDS views are more flexible. One can make more complex selections by ABAP CDS views and therefore can omit post-processing of data, such as with using SQL UNION in an ABAP CDS view.

No Comments

Most Recent Articles

Will SAP UI5 replace the SAP Web UI?

SAP Full Forms

More Similar Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu