Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

Introduction to

ABAP Core Data Services


ABAP Platform Product Management, SAP SE
May 2024

PUBLIC

PUBLIC 1
Agenda

MODERN ABAP DEVELOPMENT

ABAP CORE DATA SERVICES (CDS) OVERVIEW

CDS IN ABAP APPLICATION PROGRAMMING

SUMMARY

PUBLIC 2
MODERN ABAP DEVELOPMENT

PUBLIC 3
ABAP Platform – Foundation of SAP’s ERP applications

SAP SAP SAP SAP ABAP Cloud based


BUSINESS S/4HANA S/4HANA S/4HANA SAP BTP solutions &
SUITE any premise Cloud Cloud extensions
& SAP NetWeaver products Private Public
like SAP BW, SAP PI, … Edition Edition

RISE with SAP GROW with SAP INTEGRATE

ABAP Platform 2023 ABAP Platform SAP BTP ABAP


SAP NetWeaver Cloud Environment
No new releases, only patches Every 2 years a new release Half-yearly releases
Any database SAP HANA only Quarterly releases
SAP HANA only SAP HANA Cloud only

Improvements ONE COMMON ABAP PLATFORM INNOVATION CODELINE

Maintenance ends
Maintenance until 2040
2027/2030
PUBLIC 4
Modern ABAP application development
Must learn topics: UX, SAP HANA, state of the art development, Cloud

Focus on Utilize SAP HANA Efficient


Cloud
User Experience capabilities development

On any device ABAP-managed Secure app development, Stable Cloud extensions


Code Pushdown high code quality
Role based In-app and side-by-side
Advanced application and Agile & test driven
Device switch and Released APIs
Function libraries
collaboration Customer code
Cloud ready apps
management
Browser based

SAP Fiori and SAPUI5, ABAP SQL, In-App extensibility,


ABAP language and tools,
ABAP RESTful Application Core Data Services, Developer extensibility,
Development methodology
Programming Model SAP HANA breakouts SAP BTP

PUBLIC 5
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

PUBLIC 6
Modern ABAP application development
Golden rules for SQL programming – Priority shift on SAP HANA

Keep result sets small UNCHANGED

Minimize amaount of transferred data MORE IMPORTANT One aspect of code-to-data paradigm

Minimize number of data transfered MORE IMPORTANT One aspect of code-to-data paradigm

Minimize search overgead LESS IMPORTANT Still relevant for some use cases

Keep load away from database LESS IMPORTANT Code-to-data paradigm where applicable

PUBLIC More in this blog 7


Modern ABAP application development on SAP HANA

MAINSTREAM
ABAP managed code pushdown

ABAP Core Data Services (CDS)


ABAP SQL (fka Open SQL)

ABAP Managed Database Procedures


(AMDP) – Procedures and Functions
CDS Table Functions
SAP HANA BREAKOUTS

PUBLIC 8
Evolution of ABAP CDS and Open/ABAP SQL
CLASSIC OPTIMIZED ACCESS OPTIMIZED and SPECIALIZED ACCESS
ACCESS for SAP HANA for SAP HANA

CLOUD QUALITIES

(Key User) Extensibility


CDS / OPEN SQL CDS / OPEN SQL CDS / ABAP SQL2
Allowlisting-support for
CDS & AMDPs
DB Administration
BREAKOUTS1 BREAKOUTS1 Supportability
ABAP RESTful Programming
Model support

SQL SQL SQL SQLScript SQL SQL Extensions Specialized Engines SQLScript
Windowing Hierarchies Graph
CTE GEO Spatial Support
DB Tuning Objects
(view caches)

ANYDB ANYDB SAP HANA SAP HANA


Release 7.4 Release 7.50 – 7.52 Release ≥ 7.53
1*AMDP procedures and functions, CDS table functions, and CDS hierarchies
PUBLIC 9
2*Open SQL was renamed to ABAP SQL starting with ABAP Platform 1809
Efficient ABAP development in Eclipse

HIGH DEVELOPER PRODUCTIVITY ON-PREMISE AND IN THE CLOUD

MODERN DEVELOPMENT TOOLSET


Fully eclipse-based
Syntax check, code completion
Navigation, search, quick fixes
Full support for the ABAP RESTful
Application Programming Model and CDS

QUALITY ASSURANCE
Static code checks (ATC, CVA) with
remote and local scenarios
Unit testing incl. isolation frameworks
Test seams and injections

SUPPORTABILITY
Debugging, profiling, tracing
Static and dynamic logging
Runtime monitoring and analysis

PUBLIC 10
ABAP CDS OVERVIEW

PUBLIC 11
ABAP CDS – Next generation data modeling and access

COMMON DATA MODEL

Semantically rich
Declarative
Close to conceptual thinking

IMPROVED PROGRAMMING MODEL

For all application domains


Rich set of built-in functions
Code pushdown capabilities
Declarative access control

CAPTURE BUSINESS INTENT


Reduced complexity
Extending SQL

PUBLIC 12
ABAP CDS data models

NATIVE CONSUMPTION SERVICE CONSUMPTION


Business
ABAP SQL CDS AMDP EML SAP Fiori UI Analytical client Web APIs SQL
events
CONSUMPTION

SERVICE BINDING

SERVICE DEFINITION

BUSINESS SERVICE SERVICE PROJECTIONS AND INTERFACES


EXPOSURE
CDS projection views
& DATA ACCESS

EXTENSIBILITY
TUNING OBJECTS CDS DATA MODELS

ABAP tuning objects Domain specific data models


CDS access
CDS types
DATA CDS table functions for SAP HANA native controls
CDS modeling entities
MODELING SAP HANA tuning objects objects (procedures, functions)

PUBLIC 13
ABAP CDS – Overview of supported CDS entity types1
Category ABAP CDS Entity Type ABAP CDS Statement

Standard view building CDS View Entity DEFINE VIEW ENTITY


CDS Projection View DEFINE VIEW ENTITY AS PROJECTION ON
CDS Projection View – Analytical Query DEFINE TRANSIENT VIEW ENTITY AS PROJECTION ON
CDS DDIC-based View (deprecated) DEFINE VIEW (deprecated)

Advanced view building – External implementation CDS Custom Entity DEFINE CUSTOM ENTITY
CDS Abstract Entity DEFINE ABSTRACT ENTITY

Advanced view building – SAP HANA breakout CDS Table Function DEFINE TABLE FUNCTION
CDS Hierarchy DEFINE HIERARCHY
2
CDS Scalar Function DEFINE SCALAR FUNCTION

2
Type definition CDS Simple Type DEFINE SIMPLE TYPE
2
CDS Enumerated Type DEFINE TYPE ENUM

Transactional behavior definition of business objects built CDS Behavior Definition (and Projection) DEFINE BEHAVIOR
with the ABAP RESTful Application Programming Model

Modification-free extension CDS View Entity Extension EXTEND VIEW ENTITY


CDS Custom Entity Extension EXTEND CUSTOM ENTITY
CDS Abstract Entity Extension EXTEND ABSTRACT ENTITY
CDS DDIC-based View Extension (deprecated) EXTEND VIEW (deprecated)
CDS Metadata Extension ANNOTATE VIEW
CDS Behavior Extension EXTEND BEHAVIOR

Access control definition CDS Access Control DEFINE ROLE

PUBLIC 1 Status from Q2/2024 | 2 Available on-prem starting with Release 2023 14
ABAP CDS view entity – Example
View annotations

View definition Data source

Associations

Element annotations

Selection

ABAP Flight Reference Scenario -


Example available in package /DMO/FLIGHT_DRAFT

PUBLIC 15
Built-in SQL functions and expressions

GENERIC/
CONVERSION DATE/TIME
AGGREGATION

NUMERIC STRING

PUBLIC 16
CDS annotations for domain-specific frameworks

SAP FIORI Enrich meta model with consumer-specific


ANALYTICS PLANNING
ELEMENTS vocabularies

Reusable and unified view model for all use


CDS cases
ANNOTATION
Enabling flexible usage in different contexts
DOMAINS
Separation of concern using CDS metadata
extensions for UI-specific annotations
BI-TOOLS SEARCH …
Vital part of new ABAP programming models

PUBLIC 17
CDS associations
FROM
CLAUSE

Capturing the relationships between entities


in the data model INNER
JOIN

Used associations are implicitly translated


into SQL joins

Reuse of generated joins when semantically WHERE PROJECTION HAVING GROUP BY


identical CLAUSE LIST CLAUSE CLAUSE

Can be queried in CDS views and ABAP SQL


Navigate thru entity using path expressions

LEFT
OUTER
JOIN

PUBLIC 18
Nested CDS views and extensibility

Consumer Consumer Consumer Extensions


C1 C2 C3

Hierarchical view-on-view concept

Optimized result sets with minimum


data transfer
View on View View on View & Modification-free append of additional
V1 V2
columns, arithmetic expressions or
literals to result set

Basic view
entity

PUBLIC 19
CDS hierarchies – Build hierarchies on SAP HANA
CDS source view

Self association

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 ABAP CDS hierarchy


source of an ABAP SQL query, and it is
handled like a hierarchy in which additional
CDS source view
hierarchy columns can be selected

Filter results

PUBLIC 20
Declarative access control with CDS roles

PFCG PFCG
<Code> Declarative instead of coded approach
<Code>
Using CDS Data Control Language (DCL)
CDS role Explicitly defined for each CDS entity
ABAP SQL
Based on PFCG conditions, literal
conditions, user conditions, and
inheritance conditions
Authorization
ABAP SQL &
check Defined once and automatically used
everywhere

Authorizations pushed down to the


<Code> <Code> database
CDS entities

CLASSICAL APPROACH DECLARATIVE APPROACH

PUBLIC 21
CDS development in Eclipse

01 02 03
Development support Supportability
Syntax check Enhanced data preview
Code completion Dependency analyser
Eclipse-based CDS Tooling Syntax highlighting, pretty printing Activation graph / Dictionary log
Source-based editor Element info and navigation Active annotations view
Part of ABAP Development tools Quick fixes Unit testing

PUBLIC 22
SAP HANA Breakouts

PUBLIC 23
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

PUBLIC 24
ABAP managed database procedures (AMDP) for SAP HANA

EASY ACCESS TO
UTILIZE NATIVE INTEGRATED IN THE SAP HANA ADVANCED
SAP HANA ENTITIES ABAP INFRASTRUCTURE ENGINES / LIBRARIES

Stored procedures, database Development, runtime error analysis,


functions and scalar functions enhancement, transport
supported
SAP HANA SQLScript coding Like predictive analysis, financials, text
Expression of complex logic embedded in ABAP classes mining, calculation engine
Parameterized requests and Seamless integration into CDS via
multiple result sets CDS table functions

PUBLIC 25
CDS table functions – Seamless AMDP integration into CDS

CDS table function definition Runtime for table function


Parameter list Runs stored SQLScript procedure
Return Parameter generated from AMDP on database
tables
Reference to implementing method

AMDP
class
SAP HANA
DDL Database
Source

AMDP function
Implementation
Includes SQLScript based
database function body
PUBLIC 26
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

PUBLIC 27
CORE DATA SERVICES IN
ABAP APPLICATION PROGRAMMING

PUBLIC 28
ABAP Cloud big picture

SAP FIORI APPS


APP
ANALYTICAL APPS

Git based transport management with gCTS and abapGit


Cloud-readiness, IAM4, BC5, extensibility, security, ...
REUSE SERVICES AND LIBRARIES
BUSINESS UI SERVICES INTEGRATION SERVICES

key user & monitoring tools


LIFECYCLE MANAGEMENT
SERVICE for SAP Fiori and analytical clients for process and data integration

Output management, jobs., XCO, ...


EXPOSURE (OData, business events, HTTP, SOAP, RFC, SQL)

BUILT-IN QUALITIES
(OData and InA1)

TOOLS
DOMAIN-SPECIFIC MODELS
CDS2 entity, RAP3 Business Object, CDS analytical provider
DOMAIN-SPECIFIC
IMPLEMENTATION

BAS7,
DOMAIN-SPECIFIC LOGIC

ADT6,
ABAP, CDS

BUSINESS INTEGRATION SERVICES


DATABASE SAP HANA SERVICE for process and data integration
(OData, business events, HTTP, SOAP,
(SQL and SQLScript) CONSUMPTION RFC, SQL)

1 Information access 3 ABAP RESTful application programming model 5 Business Configuration 7 Business Application Studio
PUBLIC 29
2 Core Data Services 4 Identity& Access Management 6 ABAP Development Tools
ABAP RESTful
APPLICATION
PROGRAMMING
MODEL (RAP)

PUBLIC 30
Evolution of the ABAP programming model
CDS as vital part of SAP S/4HANA and SAP BTP ABAP Environment

ABAP PLATFORM ≤ 7.5 ABAP PLATFORM ≥ 7.5 SAP BTP


ABAP ENVIRONMENT
SAP S/4HANA ≥ 1909

CLASSIC ABAP ABAP PROGRAMMING ABAP RESTful


PROGRAMMING MODEL FOR APPLICATION
SAP FIORI PROGRAMMING
MODEL (RAP)

Best practice freestyle ABAP CDS, CDS-based BOPF, CDS, Behavior Definition &
programming, (Web) Dynpro, SEGW/@OData annotation Implementation, Business
CDS1 with Referenced Data Source Services
1 starting with release 7.4 SPS05

Safe investments!

PUBLIC 31
ABAP RESTful application programming model – Big picture
At the heart of ABAP Cloud for transactional scenarios
APP SAP FIORI APPS

UI SERVICES INTEGRATION SERVICES


for SAP Fiori and analytical clients for process and data integration
BUSINESS (OData) (OData based Web API, business events)
SERVICE
EXPOSURE
SERVICE BINDING
Service Definition, Service Projection, Event Binding

DOMAIN-SPECIFIC MODELS
CDS1 entity, RAP2 Business Object
DOMAIN-SPECIFIC
IMPLEMENTATION
DOMAIN-SPECIFIC LOGIC
ABAP, CDS

DATABASE SAP HANA 1 Core Data Services


(SQL and SQLScript) 2 ABAP RESTful application
programming model
PUBLIC 32
Virtual Data Model (VDM) for application data in SAP S/4HANA

CLIENTS

VDM is a set of views on SAP S/4HANA application data


Business-oriented
Understandable & semantically rich
SalesOrder Customer Reusable & stable
Executed on SAP HANA

SalesOrderItem Material Implemented as ABAP CDS views

VDM is the data model and source for all types of apps
Transactional

SAP S/4HANA Core Tables (ECC) Analytical


> 40 000 Tables External interfaces
(technical, cryptic, unrelated)
Customers and partners can develop on released VDM views

SAP S/4HANA & SAP S/4HANA Cloud

PUBLIC 33
CDS in SAP S/4HANA – Recommendations

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

PUBLIC 34
ANALYTICS

PUBLIC 35
Motivation for embedded analytics

Transactional Simple Analytics Multi Dimensional Embedded Analytics

Daily business tasks


Intention Daily business tasks Fast and easy insights Interactive analysis Fast insights & access to
interactive analysis

Interactivity Linear Static Highly dynamic On demand

Low Low-medium High


Complexity Mixed
Single data sets Aggregating single sets Lots of data sets

Dynamic: different types on


Aggregations Very few Yes All
different levels

Simple requests One request Each interaction may


Requests Both
Few data Complexity varies trigger a complex request

Request Types CRUD Read Read Both

Live data Replicated data


Data Sources Live data Live data
May be precalculated & live data

PUBLIC 36
ABAP analytics – Big picture
At the heart of ABAP Cloud for analytical scenarios
APP ANALYTICAL APPS

UI SERVICES
UI services for analytical clients
BUSINESS (InA1)
SERVICE
EXPOSURE
SERVICE BINDING
Service Definition, Service Projection

DOMAIN-SPECIFIC DATA MODELING


CDS2 analytical provider
DOMAIN-SPECIFIC
IMPLEMENTATION
DOMAIN-SPECIFIC LOGIC
ABAP, CDS

BUSINESS INTEGRATION SERVICES


DATABASE SAP HANA SERVICE for data integration
(SQL)
(SQL and SQLScript) CONSUMPTION 1 Information access
2 Core Data Services
PUBLIC 37
Standard development flow

= X = X

SERVICE CONSUMPTION
Clients

Multi-dimensional analysis SAC-Story


In Multi-Dimensional Analytical Clients O O

SAP Fiori Ext. usage


InA Service

SERVICE BINDING
BUSINESS SERVICE EXPOSURE
For Information Access Protocol (InA) SERVICE DEFINITION

Query
ABAP CDS

DOMAIN-SPECIFIC MODEL Dimension Dimension

Analytical star schema in ABAP CDS Cube


Dimension Dimension

PUBLIC 38
SUMMARY

PUBLIC 41
Key takeaways

ABAP Core Data Services (CDS)

Code pushdown is the ABAP programming paradigm on SAP HANA

CDS offers advanced capabilities to fully leverage SAP HANA’s power in ABAP applications

CDS is the next generation data modelling infrastructure on the ABAP platform

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

Further enhancements and optimizations will be delivered with future ABAP platform releases

PUBLIC 42
More 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
❖ 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

PUBLIC 43
Thank you.
Contact information:

Name
Email

PUBLIC
© 2024 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to this material. 44

You might also like