Anda di halaman 1dari 6

Core Data Services [CDS] in SAP S/4 HANA

September 26, 2016 | 4,003 Views |

Shivankit Bisht


more by this author
SAP S/4HANA
SAP HANA abapcdsDatabasehanaMaster Data Managements/4hanasapsap hana

 share 0
 share 0
 tweet
 share 14

Follow
A data model represents framework of what relationships are in a database. Data models are the foundation of software
development. They provide a standardized method for defining and formatting database contents consistently across
systems, enabling different applications to share the same data.
Professional data modeling tools provide a way to generate SQL from a modeled ER diagram although some developers
often prefer writing SQL directly. Below is a look of a data model.

Virtual Data Model


The concept of the Virtual Data Model (VDM) was introduced with HANA Live three years ago. SAP HANA Live is a Virtual
data model on top of suite tables which uses native SAP HANA SQL views called Calculation views for real-time
operational Reporting. This came with certain issues:

 This model didn’t support hierarchies properly. Hierarchies help businesses to analyze their data in a tree structure
through different layers with drilldown capability. For example, a time hierarchy consists comprises of levels such
as fiscal year, fiscal quarter, fiscal month and so on.
 Since, the HANA Live virtual data models were defined in the HANA database layer itself as HANA calculation
views it led to duplication of security roles between Business Suite for transactional processing and HANA
database for operational reporting.

With S/4HANA, SAP launched S/4HANA Analytics as an upgrade to HANA Live. S/4HANA supports a new data model by
providing a ready-to-use content using CDS view. The CDS data model used by SAP S/4HANA can be considered a
successor to the virtual data model used by SAP HANA Live as the new CDS provides certain advantages over VDM
which are discussed later in this blog.
As for our customers, which are the current users of HANA Live nothing changes unless they migrate to S/4 HANA. The
existing virtual data models will continue to be supported by SAP. Once customers migrate to S/4HANA, the new CDS-
based views can be used and upgraded against the simplified data model in S/4HANA.
Core Data Services
With the availability of the SAP HANA platform there has been a paradigm shift in the way business applications are
developed at SAP. The rule-of-thumb is: Do as much as you can in the database to get the best performance.
To take advantage of SAP HANA for application development, SAP introduced a new data modeling infrastructure known
as core data services. With CDS, data models are defined and consumed on the database rather than on the application
server. CDS also offers capabilities beyond the traditional data modeling tools, including support for conceptual modeling
and relationship definitions, built-in functions, and extensions

Technically, CDS is an enhancement of SQL which provides a Data Definition Language (DDL) for defining semantically
rich database tables/views (CDS entities) and user-defined types in the database. Some .of the enhancements are:

 Expressions used for calculations and queries in the data model


 Associations on a conceptual level, replacing joins with simple path expressions in queries
 Annotations to enrich the data models with additional (domain specific) metadata

CDS Value Proposition for Customers


CDS offers a SQL based layer that extends the SQL-92 standard with features that bridge and unify the traditionalOLTP
and OLAP models of data definition, data query, and data manipulation. Supported natively in both ABAP and SAP
HANA, the data models are expressed in data definition language (DDL) and are defined as CDS views, which can be
used in ABAP programs via Open SQL statements to enable access to the database. CDS provides a range of
advantages for businesses and developers, including:
Semantically rich data models
CDS builds on the well-known entity relationship model and is declarative in nature, very close to conceptual thinking.
Compatibility across any database platform
CDS is generated into managed Open SQL views and is natively integrated into the SAP HANA layer. These views
based on Open SQL are supported by all major database vendors
Efficiency
CDS offers a variety of highly efficient built-in functions — such as SQL operators, aggregations, and expressions — for
creating views.
Support for annotations.
The CDS syntax supports domain-specific annotations that can be easily evaluated by other components, such as the
UI, analytics, and OData services.
Support for conceptual associations
CDS helps you define associations that serve as relationships between different views. Path expressions can be used to
navigate along relations. Introducing an abstraction of foreign key relationships and joins, associations make navigation
between entities consumable
Extensibility.
Customers can extend SAP-defined CDS views with fields that will be automatically added to the CDS view along with its
usage hierarchy.
SAP HANA Live(based upon VDM) SAP S/4 Analytics ( based upon CDS )

Best of HANA Live Features


+

 No latency
 Full ABAP Lifecycle Integration
 No data duplication
 Supports ERP authorizations
 Integration scenarios with SAP BW
 Supports ERP hierarchies
 Ready to use content
 Part of the general Extensibility concept
 Supports more business cases
(Analytics, search, Fact sheets, planning…)

VDM to CDS Migration


In order to ensure a smooth migration from HANA Live VDM Model to S/4 HANA VDM CDS Model, SAP provides a
migration roadmap tailored for the Customer businesses. In the past a lot of effort was spent to define and implement the
HANA Live Virtual Data Model based on HANA Calculation Views. This is used as a starting point for the definition and
implementation of the CDS Data Model. CDS views are generated for the Calculation views. Please note, after the
generation additional effort is necessary to adapt the generated views to the new approach (CDS). Typical tasks which
might be necessary are:

 Adding needed CDS annotations for analytical or other scenarios. Annotations allow to enhance the core Meta
model with consumer-specific vocabularies.
 Restructuring or renaming the views to support the higher level of reuse which shall be reached with the new
approach (Using naming convention like I view for public view, P for Private and C for Consumption views).
 Adapting the views that as parts of the original functionality could not be migrated due to missing or different
features in CDS.
 Adapting the views to changed view behavior (if on running the view, a different result for the views is
displayed).

However, not all of these manual tasks are necessary for each migrated calculation view. In particular, “simple” views can
often be left unchanged after generation.
Example: Calculation View “sap.hba.ecc.BusinessTransactionType”
The calculation view “BusinessTransactionType” has a text join node “Join_1” with the join condition “TJ01.VRGNG =
TJ01T.VRGNG” .

If associations are used for join nodes and the resulting CDS view definition has following form:
NAMESPACE sap.hba.ecc;
DEFINE VIEW BusTransType AS SELECT FROM "SAP_ECC".TJ01
ASSOCIATION [1, 0..1] TO "SAP_ECC".TJ01T as _Text ON TJ01.VRGNG = _Text.VRGNG
and _Text.SPRAS = $session.system.language

{
TJ01.VRGNG AS BusinessTransactionType,
TJ01T.TXT AS BusinessTransactionTypeName ,
TJ01.WTKAT AS ControllingValueCategory ,
TJ01.PSIKZ AS ControllingValueClassification
};

If standard SQL joins are used for join nodes the resulting CDS view definition looks like this:
NAMESPACE sap.hba.ecc;
DEFINE VIEW BusTransType AS SELECT FROM "SAP_ECC".TJ01
LEFT JOIN "SAP_ECC".TJ01T
ON
TJ01.VRGNG = TJ01T.VRGNG and

TJ01T.SPRAS = $session.system.language

{
TJ01.VRGNG AS BusTransTypee,
TJ01T.TXT AS BusinessTransactionTypeName ,
TJ01.WTKAT AS ControllingValueCategory ,
TJ01.PSIKZ AS ControllingValueClassification
};
CDS: Development Environment
CDS views can be developed and maintained in SAP HANA studio and in ABAP in Eclipse. The textual editor in
eclipse provides rich feature set for fast development like:

 Code completion
 Data preview
 Quick-fix function
 Syntax highlighting

NOTE: To search for CDS view for an ABAP table, call se11 transaction. Enter the table name and click on
Where used list. Select the type DDL source and the result list will show the views for that consume the table.

Consumption of CDS in an OData Service


Key Takeaways:

 CDS provides a unified data model across all application domains


 CDS provides one semantic layer for all use cases: search, operational and analytical
 CDS extends SQL to capture the business intent instead of technical complexity.

Learn more about CDS from here:


My CDS view self study tutorial – Part 1 how to test odata service generated by CDS view
SAP HANA SPS 09: New Developer Features; Core Data Services
New Core Data Services Features in SAP HANA 1.0 SPS 10

Besides this, a great video by Björn Goerke, Executive Vice President and Corporate Officer, Head of
Technology in Products and Innovation on CDS

Alert Moderator
3 Comments
You must be Logged on to comment or reply to a post.

1. Thorsten WatzkeNovember 11, 2016 at 1:11 pm


Hi,
I’m also working with CDS-Views in the area of hana analytics.
I’m looking for a list of all CDS-Views that can be used for analytical use. There are pre-configured
views for example in the package VDM_SD or VDM_LE.
But where can I find a list of all usable views (interface and consumption views)?
Thanks in advance and best regards
Thorsten
like (0)
1. vivek singhNovember 16, 2016 at 6:12 am
Hey Thorsten,
Did you got the list, I am also looking for the same.
Regards,
Vivek
like (0)

2. Vikash AgrawalNovember 30, 2016 at 4:01 pm


Hi, Thanks for good blog. I have a question whether CDS views can be used to transfer data to Hadoop
from S/4HANA?
like (0)