Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Technical Overview of CDS View – SAP HANA Part I

2,837 views

Published on

SAP HANA has introduced new paradigms to SAP ABAP application programming. Before SAP HANA, development paradigm in SAP was based on DATA-to-Code where intensive calculation was done at the application layer and database utilization was minimized. New programming paradigm in SAP HANA is Code-to-Data, where the intensive calculation is done at the database layer and less programming at application layer.

Published in: Software
  • Be the first to comment

Technical Overview of CDS View – SAP HANA Part I

  1. 1. SAP HANA has introduced new paradigms to SAP ABAP application programming. Before SAP HANA, development paradigm in SAP was based on DATA-to-Code where intensive calculation was done at the application layer and database utilization was minimized. New programming paradigm in SAP HANA is Code-to-Data, where the intensive calculation is done at the database layer and less programming at application layer. Core data services (CDS) is based on new programming paradigm in SAP HANA. CDS is a new data modelling technique in SAP HANA. It can be defined as below: It is an infrastructure that can be used by database developers to create the underlying (persistent) data model which the application services expose to UI clients. Above definition can easily be explained in below diagram Power of CDS view Earlier ABAPer’s were always asked to reduce database hits to improve program performance. All required data was fetched from database in one, two or more select queries and then the fetched data was filtered in ABAP program using loops, sorting, binary search or sometimes with nested loops. All these activities took place at the application layer. In ABAP versions before SAP HANA, all required data is fetched from database layer to application layer and for this, a connection is set up from application layer to database layer. Some resources are utilized in making this connection that could impact the performance of the program. With the introduction of CDS, there is no need to fetch data from database layer to application layer. CDS is a technique to push the code down to the database layer. It means when CDS view is used in ABAP program, it automatically runs at the database layer. It fetches all required data and does filtration at the database layer. Only results are passed from database layer to application layer. Let us take an example to understand this technique. We need to fetch all customers id, name, and address for organisation unit 1710. If the code is written in simple ABAP program, the code would be written as follows. Three select queries would execute to fetch data from the database and then 3 nested loops to filter that data. Figure1: CDS in SAP HANA Native application model With CDS, data models are defined and consumed on database server rather than on application server. CDS also offers capabilities beyond the traditional data modelling tools, including support for conceptual modelling and relationship definitions, built-in functions, and extensions. CDS simplifies and harmonizes the way you define and consume your data models, regardless of the consumption technology. Technically, it is an enhancement of SQL which provides you with a data definition language (DDL) for defining semantically rich database tables/views (CDS entities) and user-defined types in the database. The same code can be written in one select query using CDS views as follows: Here ‘ZCDS_CUSTOMER’ is our CDS view. The question can be asked whether this can also be achieved using SE11 views. The answer is that the same can be done in SE11 view also, but there are performance implications. Difference between SE11 and CDS view It is true that a view can be created in SE11 by joining 3 tables but the SE11 view and CDS views work completely differently. Blog Technical Overview of CDS View – SAP HANA Part I by Rashmi Bansal, Accrete Solutions
  2. 2. For all enquiries please contact at : corp@accretesol.com , Tel : +1(877)-849-5838 Visit us at : www.accrete-solutions.com USA Head Office 3350 Scott Blvd, Bldg 34 Santa Clara, CA 95054 South Africa 609 Lanseria Corporate Estate, Falcon Lane, Lanseria, Gauteng Chile Galvarino Gallardo 1638, Providencia, Santiago India Development Centre 102A, HARTRON, Electronics City, Gurgaon Copyright © Accrete Solutions 2018. All rights reserved. SE11 view resides at application server as it is created in the data dictionary. It creates a connection between application layer and database layer in which some resources are utilized and performance is degraded. CDS view is database object which resides at database layer and is also known to ABAP layer. Consumption of CDS View in ABAP program invokes Database Object which is residing at Database Layer. This way, an SQL can be executed without creating a database connection between ABAP Layer and Database. Only results are transferred back to ABAP layer. This will save resources for creating a database connection from ABAP Layer to Database Layer. Hence, CDS views are much faster than SE11 views. CDS views are more powerful with use of UNION and outer joins which is not possible in SE11 views. Types of CDS view CDS concept was designed for all platforms. It is database independent. It means core data services can also be used without HANA database. So, we have 2 types of CDS views: 1.HANA CDS view HANA CDS is available for SAP HANA in the HANA Studio. The DDL of CDS allow to define database tables, database views, data types by wrapping the according to native HANA SQL statements and enriching them with semantical properties. 2. ABAP CDS view CDS concept is incorporated in ABAP to enhance data dictionary capabilities at the application server. An ADT based source code allows to create ABAP CDS views. On activation of CDS, one entity is also defined in ABAP dictionary as dictionary object which can be used as data types and access in open SQL as a data source. Differences between HANA CDS and ABAP CDS view When to use CDS view CDS view contains the power of SQL which resides at database layer and its use depends on Reusability. CDS view should be created when it is required in multiple programs and there is a need for semantical and technical capabilities of CDS views. ABAP CDS in S/4 HANA ABAP CDS plays a substantial role in the foundation of SAP S/4HANA. S/4 HANA is designed to use the real power of HANA DB and for that, we need a semantic rich data model. A large number of CDS artefacts with several thousand lines of ABAP code have been defined in S/4 HANA system that creates a semantic layer on top of traditional physical SAP ERP tables. These tables that are physically present at database layer and have a complex inner structure which can be evaluated with traditional ABAP processing. The semantically rich data modelling provided by CDS enables this layer in SAP S/4HANA, facilitating simplified and efficient access to the underlying data. SAP developers are also using CDS for new SAP Business Suite developments, especially in newer software components, although it is a bit more challenging to take advantage of the full breadth of the unifying characteristics of CDS in SAP Business Suite, as its data model has evolved over time. Core Data Services (CDS) aims to be Building Block for Timeless Software. It is next generation data definition and access for database centric applications. It provides cross platform unified abstraction layer- similar to ODATA for UI abstraction. It helps build a maximum transparency for different programming models. It can be easily integrated with platform lifecycle – management. In next blog, we will discuss how to create CDS views in ADT tool.

×