ARTICLE TABLE OF CONTENTS
This is about SAP ABAP dictionary views vs. SAP ABAP CDS views.
SAP ABAP dictionary views follow the old SAP programming model: data to code.
SAP ABAP CDS views are part of the SAP’s new programming model: code to data.
So if you want to learn what it’s all about, the’re in the right place.
Let’s jump right in!
What Are the Differences Between SAP ABAP Dictionary Views and SAP ABAP CDS Views?
SAP ABAP dictionary views or Database views are created in the SE11 in the SAP ABAP dictionary.
SAP ABAP CDS views are created in Eclipse—for now. The guess is that it’ll eventually be possible to develop them in the SAP Business Application Studio, too.
The first obvious difference between an SAP ABAP dictionary view and an SAP ABAP CDS view is where they get created.
First things first—what are SAP ABAP dictionary views and SAP ABAP CDS views?
What Is an SAP ABAP Dictionary View?
SAP ABAP dictionary views fetch pre-defined data from the database.
The ABAP dictionary views use SQL Statements to get from the database the data needed for an application to process the desired result.
SAP ABAP Dictionary Views Collect Data
For instance, an ABAP program wants to output all products.
For this purpose, the application needs to pull all necessary data of a product from the database.
Rather than using a 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 the necessary tables in the database through SQL, and selects the fields from the tables for a product.
The ABAP program uses an ABAP dictionary view to get the data of the product, not an SQL statement directly.
ABAP dictionary views collect data as needed from different database tables. They’re like an additional layer between the ABAP program and the database.
For example, the name of the ABAP dictionary view is ZPRODUCTS. It has all the tables and fields for a product.
An SAP ABAP Dictionary View is Literally a View
An ABAP dictionary view is actually a view of one or more database tables.
Imagine you’re looking through binoculars at a database. You only focus on certain tables—or even one table.
The same can be said of ABAP dictionary views: you pick one table or bundle a bunch of tables together.
Plus, you can also focus on just certain fields from those tables.
For example, a database has a bunch of tables.
You want your program to return data from three tables of the database, and only one field of each table is needed.
Here’s the view: it connects those three tables and picks out only the fields needed.
Behind the Scenes is an SAP ABAP Dictionary View an SQL View
When you activate an ABAP dictionary view, a SQL view is created.
This SQL view contains the SQL syntax of the ABAP dictionary view.
For example, if you have a SQL view that connects more than one table, the SQL statement will use inner joins.
What Is an SAP ABAP CDS View?
The ABAP CDS views were introduced in ABAP 7.40 SP05. There are two types: ABAP CDS views and HANA CDS views.
They’re both part of the new SAP programming model.
SAP’s New Programming Model
The new SAP programming model pushes the logic from the application level down to the database level and up to the front end.
ABAP CDS views push logic to the database and client-side:
They take logic from an ABAP application and execute it at the database level. Annotations and OData services allow SAPUI5 Smart Controls and Fiori Elements to be controlled by ABAP CDS views, which delegate logic to the client-side.
Before SAP’s new programming model, the concept was to fetch data from the database with pre-defined SQL statements and process it at the application level. ABAP dictionary views usually describe the pre-defined SQL statements.
SQL-Fetched Data Gets Processed at the Database Level
The new programming model transfers SQL-fetched data from the application level to the database level via ABAP CDS views.
The ABAP CDS view not only pre-defines the SQL statement, but also includes the logic to process it by the SQL statement-fetched data.
The aim is to make the database level as smart as possible by using ABAP CDS views.
In the case of ABAP CDS views, the views reside at the application level in the Data Dictionary (SE11), but a CDS view can pass more logic than an ABAP dictionary view from the application server to the database through SQL.
However, a ABAP CDS view still pushes back the result of the SQL statement to the application server.
In the old programming model, the less database load, the better.
In the new programming model, the more database load, the better.
It is about Code-to-Data and no longer Data-to-Code—Code-to-the-Database and no longer Data-from-the-Database-to-the-Code.
If you want to see actual SAP ABAP CDS views, here are 3 ways to find SAP ABAP CDS views in your system implemented by SAP (at least ABAP 7.40 SP05).
SAP ABAP Dictionary Views vs. SAP ABAP CDS Views: What Are the Differences?
The following are the differences between ABAP dictionary views and ABAP CDS views:
SAP ABAP Dictionary Views
- Reside in the application server
- Support all kinds of databases
- Have limited basic SQL functions like INNER JOIN or SELECT
- No parameters
SAP ABAP CDS Views
- Reside in the application server
- Support all kinds of databases
- Basic SQL functions such as INNER JOIN, OUTER JOIN, UNION, or SELECT
- Perform calculations, aggregations, grouping
- Nested views
As a bonus, how do they compare to SAP HANA CDS views:
SAP HANA CDS Views
- Integrated into the database (SAP HANA XS)
- Support only SAP HANA databases
- Perform all the other features of SAP ABAP CDS Views
- Explicit features for the SAP HANA database
5 Reasons to Use SAP ABAP CDS Views Instead of SAP ABAP Dictionary Views in an SAP R/3 or SAP ECC System
There are 5 reasons to use SAP ABAP CDS views instead of SAP ABAP dictionary views in a SAP R/3 or SAP ECC system (in an S/4HANA system, you’ll use them anyway):
- Upward compatibility to S/4HANA
- Easy generation of full-fledged OData Services
- Easy use of SAPUI5 Smart Controls and Fiori Elements
- Implicit authorization checks
- Performance boost (see below)
Performance Difference Between SAP ABAP Dictionary Views and SAP ABAP CDS Views
There is no performance difference between ABAP dictionary views and ABAP CDS views in an ABAP stack with at least 7.40 SP05.
Such an ABAP stack with or without an ABAP CDS view uses the same SQL behind the scenes.
The performance is the same if you execute the same request with an ABAP dictionary view or an ABAP CDS view.
However, there is a performance difference in that ABAP CDS views are more flexible:
ABAP CDS views let one make more complex selections and therefore don’t need post-processing, such as SQL union in an ABAP CDS view.
By the way, if you’re looking for SAP ABAP CDS views best practices, this is for you.