博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CDS – One Concept, Two Flavors
阅读量:2035 次
发布时间:2019-04-28

本文共 6486 字,大约阅读时间需要 21 分钟。

If you search the web or SCN for CDS, SAP’s Core Data Services, you can easily find statements like“.”. On the other hand, there also seems to be something called . How are they connected? Let’s have a look from the ABAP (and even ABAP CDS) docu writer’s worm’s eye view.

ABAP Dictionary

In order to develop (business) applications, you need something to model your data. In the ABAP world, meaning on the ABAP application server, for this purpose you used the ABAP Dictionary or tools like the data modeler for years. The ABAP Dictionary was and is the platform independent metadata repository for database tables and database views that can be accessed in ABAP using Open SQL. The definition of the database entities is done in the form based ABAP Dictionary tool on the application server and  the according DDL is passed to the database via the DBI (Database Interface). You can examine that by looking at the “Database Object” in SE11. E.g., for a view, you see the according DDL statement CREATE VIEW.  For an ABAP program, the entities defined in the ABAP Dictionary act like global types, making it simple to declare ABAP data objects as targets or sources for DML statements in Open SQL.

HANA CDS

With the dawn of SAP HANA and the possiblity to develop applications directly on the database, not using an application server any more, the need arised, to create a meta model repository directly on the database. As with the ABAP Dictionary on the application server, there should be more in the box for you than using native SQL’s CREATE TABLE or CREATE VIEW. Especially regarding the need of enriching pure technical definitions wih semantics. And that’s one of the main reasons for SAP’s Core Data Services.

Core Data Services provide a specification for an SQL-based DDL that is enriched with further possibilities like annotations or associations that generally can be implemented on different platforms. On SAP HANA, CDS provides the possibility “.” The DDL of CDS allows you  to define database tables, database views, data types by wrapping the according native HANA SQL statements and enriching them with semantical properties. From an ABAP programmer’s point of view, one might say: Well, OK, there’s a source code based dictionary tool directly on the HANA database. But that would be too shirt-sighted.

ABAP CDS

From the beginning, CDS was not designed for HANA alone. Also the ABAP application server should be able to benefit from the enhanced capabilities that are offered by the DDL of CDS compared to the form based ABAP Dictionary tool. Since the ABAP Dictionary with its capabilty of defining tables, views and data types was already there, the natural way of introducing CDS on the ABAP application server was to add it to the ABAP Dictionary. An ADT based source code editor allows you to create DDL sources. On activation,  the CDS entities defined in such a DDL source become full citizen ABAP Dictionary objects. They work as ABAP types that can be named after a TYPE addition and they can be accessed in Open SQL. As a first step, the advanced view building capabilities of CDS have been implemented in ABAP CDS. With many, many tables already defined in the ABAP Dictionary, thestatement of ABAP CDS makes the full wealth of the CDS universe readily available to existing ABAP data models. You can either define sophisticated new views or simply wrap an existing table in a CDS view in order to enrich it semantically. For example, ABAP CDS offers a new authorization concept based on roles defined wih  (partly released wth 7.40, SP10 and fully released with ABAP 7.50) in a DCL source code. In order to let an existing table participate in the new authorization concept, you can simply create a CDS view for that table that is connected to a role. Other examples are advanced joining of tables with associations or using specific annotations in order to connect existing tables to new technologies like OData or UI5. Even in ABAP itself, CDS views are handled in an advanced way compared to classical dictionary objects – automatic client handling is an example. So, with introducing CDS views in the ABAP Dictionary one big step is already taken. Capabilities to create database tables, database functions (available with ABAP 7.50), and data types in ABAP CDS might follow. This would ultimately allow you to create data models in the ABAP Dictionary from scratch using ABAP CDS only.

ABAP CDS vs. HANA CDS

With HANA CDS and ABAP CDS we have two implementations based on the same specification. The implementations are very similar but not 100 % equal.  If you know the DDL of CDS, you should be able to understand definitions of CDS entities in both flavors. But as a rule you will not be able to copy DDL sources from HANA to ABAP and vice versa without modifications.  The implementation of HANA CDS and ABAP CDS is ongoing and with different priorities.That’s why a blog like   is mainly interesting for developers working directly on SAP HANA. ABAP developers have to look for blogs like 

While HANA CDS has to function on SAP HANA only, ABAP CDS is open. Consequently there are some restrictions for ABAP CDS that do not exist for HANA CDS (in the same way as Open SQL is more restricted than Native SQL). A good example are built-in functions. A built-in function likeoffered in ABAP CDS must be available on any database platform and  – very important – must behave in the same way on all platforms. Same for expressions like arithmetic expressions, aggregates or the CAST expression. Before releasing such a functionality in ABAP CDS, all platforms have to participate. Quiet a task!  And thats why ABAP CDS cannot offer all of SAP HANA yet (but …). On the other hand,it is open! And there are also ABAP specialties like client handling or table buffering that are not available in HANA CDS, but supported in ABAP CDS.

Conclusion

SAP’s Core Data Services provide a single concept for an infrastructure for data modelling that is implemented  in SAP HANA as well as on the ABAP application server. The design principles are the same for both implementations but due to differences in the respective environments, there are naturally some differences between these flavors.

Note

To my knowledge, there is no native implementation of the CDS concept on other database platforms than on SAP HANA up to now. In order to model in CDS for databases other than HANA, you can of course use ABAP CDS in the ABAP Dictionary, and let it push down the model for you.

转载地址:http://komaf.baihongyu.com/

你可能感兴趣的文章
(PAT 1118) Birds in Forest (并查集)
查看>>
数据结构 拓扑排序
查看>>
(PAT 1040) Longest Symmetric String (DP-最长回文子串)
查看>>
(PAT 1145) Hashing - Average Search Time (哈希表冲突处理)
查看>>
(1129) Recommendation System 排序
查看>>
PAT1090 Highest Price in Supply Chain 树DFS
查看>>
(PAT 1096) Consecutive Factors (质因子分解)
查看>>
(PAT 1019) General Palindromic Number (进制转换)
查看>>
(PAT 1073) Scientific Notation (字符串模拟题)
查看>>
(PAT 1080) Graduate Admission (排序)
查看>>
Tree UVA - 548 (DFS+建立二叉树)
查看>>
Play on Words UVA - 10129 (欧拉路径)
查看>>
mininet+floodlight搭建sdn环境并创建简答topo
查看>>
(计蒜客) 取石子游戏 (gcd算法灵活运用)
查看>>
Prime Path POJ - 3126 (BFS,素数距离)
查看>>
Wireless Network POJ - 2236 (并查集)
查看>>
【javascript】手写bind函数
查看>>
Kube-state-metrics的collectors配置
查看>>
使用Vmware装虚拟机Ubuntu
查看>>
【java】异常处理及捕获的理解
查看>>