Core Data Services (CDS) were introduced to define and consume data models directly on the database, offering advanced capabilities like conceptual modeling and built-in functions. CDS views enable developers to create semantically rich data models with support for various SQL operations and annotations, while also integrating with SAP HANA and ABAP. Key features include database independence, support for complex joins, and the ability to create calculated fields, although limitations exist such as the inability to debug and restrictions on result sets.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
5 views
CDS
Core Data Services (CDS) were introduced to define and consume data models directly on the database, offering advanced capabilities like conceptual modeling and built-in functions. CDS views enable developers to create semantically rich data models with support for various SQL operations and annotations, while also integrating with SAP HANA and ABAP. Key features include database independence, support for complex joins, and the ability to create calculated fields, although limitations exist such as the inability to debug and restrictions on result sets.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4
CDS(Core Data Services)
❖ Why were CDS introduced ?
➢ With CDS, Data models are defined and consumed on the database rather than on the server. ➢ CDS also offers capabilities beyond the traditional data modelling tools, including support for conceptual ➢ modelling and relationship definitions, built in functions, and extensions. ➢ Originally, CDS was available only in the design time and run time environment of SAP HANA. ➢ Now, CDS concept is also fully implemented in SAP NetWeaver AS ABAP, enabling developers to work in ABAP ➢ layer with ABAP development tools while the code execution is pushed down to the database. ❖ Why is Core Data Service (CDS) ? ➢ CDS is an infrastructure layer for defining semantically rich data models, which are represented as CDS views. ➢ In a very basic way, CDS allows developers to define entity types (such as orders, business partners, and ➢ products) and the semantic relationship between them. ➢ Which corresponds to foreign key relationships in entity relationship models. ➢ CDS is defined using SQL based DDL (Data Definition Language) that is based on standard SQL with some ➢ additional concepts such as associations. ➢ Which defines the relationships between CDS views and annotations, which defines the domain specific ➢ artifacts. ➢ Another example is expressions, which can be used in scenarios in which certain CDS attributes are ➢ considered as measures to be aggregated. ❖ Features of CDS views? ➢ Semantically rich data models. ➢ Domain specific language (LINQ, QL, SQL). ➢ Declarative, close to conceptual thinking. ➢ CDS is separately based on SQL query language. ➢ Fully compatible with any databases. ➢ Generated and managed by SQL views. ➢ Native integration in SAP HANA. ➢ Common Basis for Domain Specific Framework. E.g. UI, Analytics, OData, BW. ➢ Built-In functions and code push down. ➢ Table functions and breakout scenarios. ➢ Rich set of built in SQL functions. ➢ Extensible. ➢ On Model level through extensions. ➢ On Meta model level through annotations. ❖ Limitations of CDS: ➢ Cannot Debug, ➢ Only one Result Set can be returned, ➢ We cannot join 2 fields with Data type and length mismatches in the 2 tables, in such scenarios we need to use AMDP. ❖ Components of CDS: ➢ There are two components of CDS views in HANA. ■ DDL SQL View: - It is read only classical database view which is read only in ABAP dictionary (SE11). It cannot be edited in SE11. ■ CDS view Entity: - It is the DDL source file and the actual CDS view. It is a database object which is visible in Eclipse/HANA Studio/ADT and we cannot view the CDS View entity in SE11. It covers the CDS database view and makes other attributes possible such as authorization checks defined in CDS views. Before I Show, how the CDS view is created in HANA ADT, let me start with how the CDS view can be deleted. ■ Note: - We don’t need to delete both CDS views and Dictionary DDL SQL individually for deleting CDS views. We will not be able to delete DDL SQL views but we can delete CDS view entities. When the CDS view entity is deleted then DDL SQL view will also be deleted. ❖ Authorizations in CDS views? ➢ DCL: -Data Control Language (DCL) is used for controlling privileges in databases in database operation. ➢ Two kinds of privileges are provided to any user. ■ System, and (system access taken care by SAP. We don’t need to bother much about this) ■ Object (Authorization Objects or access). ➢ GRANT: -Used for providing any user access privileges or the other privileges for the database operations ➢ Revoke: - Used for taking back permissions from any user. ➢ Role: - Special permission created by system admin for accessing (Display/Change/Create) any particular T-Code for abap objects. These shall be maintained in T-code PFCG ❖ Types of Views. ➢ Define view: - It’s a simple view work with only one table. ➢ Define view with joins: - This view is used to join more than 2 tables using joins. ■ Define view with association: - This view is used to join more than 2 tables using association. ■ Define view with parameters: - In SE11 view can only have hard-coded selections, by this we can make selection dynamic. ➢ Extend view: - This view is used to extend the standard view. ➢ Define table functions with parameters: - By using this we can call AMDP methods in view. ❖ Advantages of CDS view. ➢ CDS views are like open SQL, they are database independent and run on any sap-supported database system. ➢ In SE11 view field calculation is not possible whereas in CDS views we can have calculated fields. (E.g. adding two fields at runtime.) ➢ CDS views support inner join, Outer join, right outer join, full join, Cross join. ➢ CDS views support automatic client handling. ➢ CDS views support open SQL and we can call them in the same way we call the SE11 view in the application layer. ➢ WHERE, GROUP BY, HAVING, UNION clauses are supported in CDS views. ➢ Aggregation and Numeric functions are supported in CDS views. ➢ We can achieve OData services directly from CDS views. ❖ What are the annotations in CDS views? ➢ @abapcatalog.compiler.comparefilter : for filtering. ➢ @abapcatalog.sqlviewname : can be defined as in se11 view name. ➢ @search.searchable : true for search help. ➢ @accesscontrol.authorizationcheck : REQUIRED or NOT_REQUIRED ➢ @endusertext.label : - that is for labelling the text into the field. ❖ Differentiate between CDS views and AMDP Class. ➢ CDS views are based on single service logic; they return only one result set in an output. Whereas AMDP classes can get the results of multiple entities together by a single service call. ➢ A CDS view can be created to read and process the data at the database layer. Whereas AMDP class can be used for processing and modifying the data at the database layer. ➢ CDS view supports open SQL statements. Whereas AMDP class supports native SQL statements. ❖ What is the difference between associations and joins? ➢ Join can be used when the user wants to get the data from two or more tables then join statements can be used. Association is a lazy join. In other words, association can also be defined as join but on demand. ➢ Association does not do actual join until and unless someone triggers in. Association defines the proper relationship between the data sources and not just joins the data sources as in joins. ➢ Association keeps the relation between the data sources visible and not concealed as in joins. ❖ What are the restrictions for using AMDP class? ➢ AMDP doesn’t support the parameter type RETURNING. You can only pass importing, exporting and changing parameters into the AMDP class. ➢ In AMDP class the parameters must be passed by value as pass by reference parameters are not allowed. ➢ Only structures, variables, and normal internal tables can be passed using AMDP classes. Complex tales like nested tables as tables in tables cannot be passed.