Contenu connexe
Similaire à Introduction to ABAP Core Data Services (CDS).pdf (20)
Introduction to ABAP Core Data Services (CDS).pdf
- 2. 2
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
The information in this presentation is confidential and proprietary to SAP and may not be disclosed without the permission of SAP.
Except for your obligation to protect confidential information, this presentation is not subject to your license agreement or any other service
or subscription agreement with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or any related
document, or to develop or release any functionality mentioned therein.
This presentation, or any related document and SAP's strategy and possible future developments, products and or platforms directions and
functionality are all subject to change and may be changed by SAP at any time for any reason without notice. The information in this
presentation is not a commitment, promise or legal obligation to deliver any material, code or functionality. This presentation is provided
without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a
particular purpose, or non-infringement. This presentation is for informational purposes and may not be incorporated into a contract. SAP
assumes no responsibility for errors or omissions in this presentation, except if such damages were caused by SAP’s intentional or gross
negligence.
All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from
expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates,
and they should not be relied upon in making purchasing decisions.
Disclaimer
- 3. 3
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
MODERN ABAP DEVELOPMENT
ABAP CORE DATA SERVICES (CDS) OVERVIEW
CDS IN ABAP APPLICATION PROGRAMMING
SUMMARY
Agenda
- 5. 5
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
On-premise and Cloud
SAP’s strategic (Cloud) ERP
SAP HANA
SAP Fiori UX
On-premise
Any DB
Legacy
(maintenance until 2027/2030)
SAP
BUSINESS
SUITE
SAP NetWeaver
SAP S/4HANA
ABAP Platform
ABAP Platform – Transformation to SAP S/4HANA and SAP BTP
SAP’s strategic cloud platform
SAP HANA
SAP Fiori UX
SAP BUSINESS
TECHNOLOGY
PLATFORM
ABAP Environment
Node.js, Java
- 6. 6
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Modern ABAP application development
Must learn topics: UX, SAP HANA, state of the art development, Cloud
Stable Cloud extensions
In-app and side-by-side
Released APIs
Cloud ready apps
Cloud
Secure app development,
high code quality
Agile & test driven
Customer code
management
Efficient
development
Utilize SAP HANA
capabilities
ABAP-managed
Code Pushdown
Advanced application and
Function libraries
Focus on
User Experience
On any device
Role based
Device switch and
collaboration
Browser based
SAP Fiori and SAPUI5,
ABAP RESTful Application
Programming Model
ABAP SQL,
Core Data Services,
SAP HANA breakouts
ABAP language and tools,
Development methodology
In-App extensibility,
Developer extensibility,
SAP BTP
- 7. 7
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
<code>
Modern ABAP application development
Programming paradigm shift powered by SAP HANA
Data-to-Code:
Data-intensive
computations
in APPLICATION
layer
Code-to-Data*:
Data-intensive
computations
in DATABASE
layer
(*) aka Code Pushdown
More in this blog
- 8. 8
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Modern ABAP application development
Golden rules for SQL programming – Priority shift on SAP HANA
More in this blog
- 9. 9
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Modern ABAP application development on SAP HANA
ABAP Core Data Services (CDS)
ABAP SQL (fka Open SQL)
ABAP Managed Database Procedures
(AMDP) – Procedures and Functions
CDS Table Functions
SAP HANA BREAKOUTS
MAINSTREAM
ABAP
managed
code
pushdown
- 10. 10
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Evolution of ABAP CDS and Open/ABAP SQL
SAP HANA
CLOUD QUALITIES
(Key User) Extensibility
Allowlisting-support for
CDS & AMDPs
DB Administration
Supportability
ABAP RESTful
Programming Model support
ANYDB
BREAKOUTS1
SQL
ANYDB
SQL SQL SQLScript
SAP HANA
SQL
Windowing
CTE
SQLScript
SQL Extensions
Hierarchies
GEO Spatial Support
DB Tuning Objects
(view caches)
Specialized Engines
Graph
OPTIMIZED and SPECIALIZED ACCESS
for SAP HANA
CLASSIC
ACCESS
BREAKOUTS1
OPTIMIZED ACCESS
for SAP HANA
CDS / OPEN SQL CDS / OPEN SQL CDS / ABAP SQL2
Release 7.4 Release 7.50 – 7.52 Release ≥ 7.53
1*AMDP procedures and functions, CDS table functions, and CDS hierarchies
2*Open SQL was renamed to ABAP SQL starting with ABAP Platform 1809
- 11. 11
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Efficient ABAP development in Eclipse
MODERN DEVELOPMENT TOOLSET
Fully eclipse-based
Syntax check, Code completion
Syntax highlighting, Pretty printing
Navigation, Search, Quick Fixes
QUALITY ASSURANCE
Static code checks (ATC, CVA) with
remote and local scenarios
Unit testing incl. isolation frameworks
Test seams and injections
SUPPORTABILITY
Debugging, profiling
Static and dynamic logging
Runtime monitoring and analysis
HIGH DEVELOPER PRODUCTIVITY WITH THE
ABAP DEVELOPMENT TOOLS (ADT)
- 13. 13
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Next generation data modeling and access
For all application domains
Rich set of built-in functions
Code pushdown capabilities
Declarative access control
Reduced complexity
Extending SQL
CORE
DATA
SERVICES
COMMON
DATA
MODEL
Semantically rich
Declarative
Close to conceptual thinking
IMPROVED
PROGRAMMING
MODEL
CAPTURE
BUSINESS
INTENT
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
- 14. 14
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Combine the best of both worlds with ABAP CDS
VIEW BUILDING
SQL views with restricted feature
set for SAP HANA capabilities
LIFECYCLE MANAGEMENT
ABAP lifecycle management e.g.
transports
ABAP type system
ABAP AS
SAP HANA
VIEW BUILDING
Specialized views (analytical
views, attribute views, calculated
views, …)
LIFECYCLE MANAGEMENT
Non ABAP lifecycle
management e.g. transports
Non ABAP type system
+
ABAP CDS
VIEW BUILDING
Advanced data modelling
leveraging DDIC semantics
Code pushdown with various built-in
SQL functions and expressions
Code breakouts to utilize native
SAP HANA features and capabilities
via CDS Table Functions
LIFECYCLE MANAGEMENT
Proven and consistent ABAP lifecycle
management e.g. transports
ABAP type system
Consumption in ABAP SQL and
ABAP frameworks
- 15. 15
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Overview of ABAP CDS entity types1
CATEGORY CDS ENTITY TYPE ABAP CDS STATEMENT
Standard view building CDS View Entity2
CDS Projection View
CDS DDIC-based View
DEFINE VIEW ENTITY
DEFINE VIEW ENTITY AS PROJECTION
DEFINE VIEW
Transactional behaviour definition of business
objects within the ABAP RESTful Application
Programming Model (RAP)
CDS Behavior Definition
CDS Behavior Projection
DEFINE BEHAVIOR
Modification-free extension CDS Metadata Extension
CDS View Extension
CDS View Entity Extension
CDS Abstract Entity Extension
ANNOTATE VIEW
EXTEND VIEW
EXTEND VIEW ENTITY
EXTEND ABSTRACT ENTITY
SAP HANA breakout CDS Table Function
CDS Hierarchy
DEFINE TABLE FUNCTION
DEFINE HIERARCHY
External implementation CDS Custom Entity
CDS Abstract Entity
DEFINE CUSTOM ENTITY
DEFINE ABSTRACT ENTITY
Access control CDS Access Control DEFINE ROLE
2 Successor of CDS DDIC-based view
1 State of Q1 2022
- 16. 16
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
ABAP CDS view entity – Example
selection
Data source
Element annotations
Associations
ABAP Flight Reference Scenario -
Example available in package /DMO/FLIGHT_DRAFT
View annotations
View definition
- 17. 17
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Built-in SQL functions and expressions
GENERIC /
AGGREGATION CONVERSION DATE / TIME
NUMERIC STRING
- 18. 18
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
CDS annotations for domain-specific frameworks
Enrich meta model with consumer-specific
vocabularies
Reusable and unified view model for all use
cases
Enabling flexible usage in different contexts
Separation of concern using CDS metadata
extensions for UI-specific annotations
Vital part of new ABAP programming models
CDS
ANNOTATION
DOMAINS
Analytics
BI-Tools
Planning
Search
SAP Fiori
elements
…
- 19. 19
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
CDS associations
WHERE
CLAUSE
PROJECTION
LIST
HAVING
CLAUSE
GROUP BY
CLAUSE
LEFT
OUTER
JOIN
FROM
CLAUSE
INNER
JOIN
Capturing the relationships between entities
in the data model
Used associations are implicitly translated
into SQL joins
Reuse of generated joins when semantically
identical
Can be queried in CDS views and Open SQL
Navigate thru entity using path expressions
- 20. 20
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Nested CDS views and extensibility
Hierarchical view-on-view concept
Optimized result sets with minimum
data transfer
Modification-free append of
additional columns, arithmetic
expressions or literals to result set
Basic View
View on View
Consumer Extensions
C1
V1
&
Consumer Consumer
C2 C3
View on View
V2
- 21. 21
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
CDS Hierarchy defines a CDS entity as a
hierarchy in the CDS DDL
A CDS hierarchy has a tabular results set
whose rows construct parent-child
relationships from hierarchical data sets
A CDS hierarchy can be accessed as the
data source of an ABAP SQL query, and it is
handled like a hierarchy in which additional
hierarchy columns can be selected
CDS hierarchies – Build hierarchies on SAP HANA
CDS source view
Self association
ABAP CDS hierarchy
CDS source view
Filter results
- 22. 22
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Declarative access control with CDS roles
Classical approach
<Code>
<Code>
ABAP SQL
Authorization
check
PFCG
Declarative approach
<Code>
<Code>
ABAP SQL
PFCG
CDS role
CDS
entities
&
Declarative instead of coded approach
Using CDS Data Control Language (DCL)
Explicitly defined for each CDS entity
Based on PFCG conditions, literal
conditions, user conditions, and
inheritance conditions
Defined once and automatically used
everywhere
Authorizations pushed down to the
database
- 23. 23
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
CDS development in Eclipse
Eclipse-based CDS Tooling
Source-based editor
Part of ABAP Development tools
01
Development support
Syntax check
Code completion
Syntax highlighting, pretty printing
Element info and navigation
Quick fixes
02
Supportability
Enhanced data preview
Dependency analyser
Activation graph / Dictionary log
Active annotations view
Unit testing
03
- 24. 24
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
SAP HANA
Breakouts
- 25. 25
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Why code breakouts for SAP HANA make sense …
UNLEASH THE FULL POTENTIAL
OF YOUR SAP HANA DATABASE
Some scenarios require
selective measures
Highest performance requirements
e.g. with complex calculations
Use of database / analytical engine
specific functions required
ABAP SQL and plain CDS views are
not sufficient to solve problem
efficiently
RESTRICTIONS
Database-specific
SAP HANA only
No automatic fallback for anyDB
- 26. 26
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
ABAP managed database procedures (AMDP) for SAP HANA
EASY ACCESS TO
SAP HANA ADVANCED
ENGINES / LIBRARIES
Like predictive analysis, financials,
text mining, calculation engine
INTEGRATED
IN THE ABAP
INFRASTRUCTURE
Development, runtime error
analysis, enhancement, transport
SAP HANA SQLScript coding
embedded in ABAP classes
Seamless integration into CDS
via CDS table functions
UTILIZE NATIVE
SAP HANA
ENTITIES
Stored procedures,
database functions and
scalar functions supported
Expression of complex logic
Parameterized requests and
multiple result sets
- 27. 27
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
CDS table functions – Seamless AMDP integration into CDS
CDS table function definition
Parameter list
Return Parameter
Reference to implementing method
AMDP function
Implementation
Runtime for table function
Runs stored SQLScript procedure
generated from AMDP on database
tables
SAP HANA
Database
DDL
Source
AMDP
class
Includes SQLScript based
database function body
- 28. 28
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
AMDP development in Eclipse
DEVELOPMENT
Eclipse-based source code editor
SQLScript syntax highlighting
Static syntax check
Error handling via class-based exceptions
Modification-free extension via AMDP BAdIs
SUPPORTABILITY
Autonomous AMDP debugger in ADT
Detailed runtime errors integrated in ST22 dumps
- 30. 30
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Evolution of the ABAP programming model
CDS as vital part of SAP S/4HANA and SAP BTP ABAP Environment
ABAP PLATFORM ≤ 7.5
CLASSIC ABAP
PROGRAMMING
Best practice freestyle ABAP
programming, (Web) Dynpro,
CDS1
ABAP PLATFORM ≥ 7.5
ABAP PROGRAMMING
MODEL FOR
SAP FIORI
CDS, CDS-based BOPF,
SEGW / @OData annotation
with Referenced Data Source
SAP BTP
ABAP ENVIRONMENT
SAP S/4HANA ≥ 1909
ABAP RESTful
APPLICATION
PROGRAMMING
MODEL (RAP)
CDS, Behavior Definition &
Implementation, Business
Services
1 starting with release 7.4 SPS05
Safe investments!
- 31. 31
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public CDS
SAP FIORI UIs
Consume OData
based UI services
CDS in the ABAP RESTful Application Programming Model (RAP)
DATA MODELING
& BEHAVIOR
BUSINESS
SERVICE
PROVISIONING
CONSUMPTION
CDS ENTITIES
CDS: Data modeling
ANALYTICAL MODEL
CDS: Analytical cubes
CDS: Analytical dimensions
ANALYTICAL PROJECTION
CDS: Analytical projection views
SERVICE DEFINITION – Define scope to be exposed
WEB APIs
Consume OData
based services
SAP ANALYTICS CLOUD
Consume InA based UI services
for live data access
DATA INTEGRATION
Consume SQL based
services
SERVICE BINDING – Bind to protocol version and scenario
BUSINESS OBJECT PROJECTION
CDS: BO projection views
BDEF: Behavior projection
ABAP: Behavior implementation
BUSINESS OBJECTS
CDS: Data modeling
BDEF: Behavior definition
ABAP: Behavior implementation
- 32. 32
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
SAP S/4HANA Core Tables (ECC)
> 40 000 Tables (technical, cryptic,
unrelated)
VDM is a set of views on SAP S/4HANA application data
Business-oriented
Understandable & semantically rich
Reusable & stable
Executed on SAP HANA
Implemented as ABAP CDS views
VDM is the data model and source for all types of apps
Transactional
Analytical
External interfaces
Customers and partners can develop on released VDM views
Virtual Data Model (VDM) for application data in SAP S/4HANA
SAP S/4HANA ABAP Platform
Virtual Data Model (ABAP CDS)
Customer
Material
SalesOrder
SalesOrderItem
- 33. 33
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
When implementing your own CDS views, follow the
SAP S/4HANA’s Virtual Data Model (VDM) implementation pattern
for best reuse and interoperability
Clarify your data model before starting your implementation
Start with the implementation of basic interface views
Adapt names and add semantical information already on this level
CDS in SAP S/4HANA – Recommendations
- 35. 35
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Key takeaways
ABAP
Core Data Services (CDS)
Code pushdown is the ABAP programming paradigm
on SAP HANA
01
Further enhancements and optimizations will be
delivered with future ABAP platform releases
03
03
CDS is the cornerstone of the ABAP RESTful
Application Programming Model (RAP)
CDS plays a vital role in SAP BTP ABAP environment
and SAP S/4HANA on-premise as well as in the cloud
03 CDS is the next generation data modelling
infrastructure on the ABAP platform
CDS offers advanced capabilities to fully leverage
SAP HANA’s power in ABAP applications
03
- 36. 36
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
FREE openSAP COURSE
ENROLL NOW!
https://open.sap.com/courses/cp13
Building Apps with the ABAP RESTful
Application Programming Model (RAP)
Self-paced mode
Week 1: Introduction
Week 2: Developing a Read-Only List Report App
Week 3: Enabling the Transactional Behavior of an App
Week 4: Dealing with Existing Code
Week 5: Service Consumption and Web APIs
Week 6: Final Exam
- 37. 37
© 2022 SAP SE or an SAP affiliate company. All rights reserved. | Public
Further information
SAP Community
▪ ABAP Development Community
▪ Landing pages: ABAP Platform 2021 | ABAP Platform 2020 | ABAP Platform 1909
| ABAP Platform 1809 | AS ABAP 7.52 | AS ABAP 7.51 | AS ABAP 7.50
▪ Getting started with ABAP development for SAP HANA
▪ Getting started with ABAP Core Data Services (CDS)
▪ Getting started with the ABAP RESTful Application Programming Model (RAP)
▪ Developer center: https://www.sap.com/developer/topics/abap-platform.html
SAP Help Portal
▪ ABAP Platform 2021 | ABAP CDS Developer Guide | ABAP Keyword Documentation
SAP training and certification opportunities
▪ www.sap.com/education – e.g. S4H430, HA400
- 39. www.sap.com/contactsap
Follow us
© 2022 SAP SE or an SAP affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of
SAP SE or an SAP affiliate company.
The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its
distributors contain proprietary software components of other software vendors. National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or
warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials.
The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty
statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional
warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or
any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation,
and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platforms, directions, and
functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason
without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or
functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ
materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, and they
should not be relied upon in making purchasing decisions.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product and service names
mentioned are the trademarks of their respective companies.
See www.sap.com/trademark for additional trademark information and notices.