Professional Documents
Culture Documents
Sap Teched Abap CDS Views PDF
Sap Teched Abap CDS Views PDF
Public
Disclaimer
This presentation outlines our general product direction and should not be relied on in making a
purchase decision. This presentation is not subject to your license agreement or any other agreement
with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or to
develop or release any functionality mentioned in this presentation. This presentation and SAP's
strategy and possible future developments are subject to change and may be changed by SAP at any
time for any reason without notice. This document 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. SAP assumes no responsibility for errors or omissions in this
document, except if such damages were caused by SAP intentionally or grossly negligent.
Key technology aspects of SAP HANA Key impacts on ABAP apps for SAP HANA
Data-To-Code:
Intensive
computations <code>
in APPLICATION
layer
Code-To-Data:
Intensive
computations
in DATABASE
layer
models
ABAP
Java
S/4HANA
[1] on 2015-07-22
© 2015 SAP SE or an SAP affiliate company. All rights reserved. Public 9
Motivation for Core Data Services
Conceptual Level
Task: Get the id, name and the respective zip code of the home address for all
employees in org-unit 4711
Implementation Level
Conceptual Level
Issue: Due to the complexity of SQL, developers are using code instead of SQL
Implementation Level
Code: SELECT * FROM Employee INTO TABLE it_empl WHERE orgunit = 4711.
LOOP AT it_empl.
WRITE it_empl-id.
WRITE it_empl-name.
SELECT * FROM Addresse INTO TABLE it_addrs WHERE id = employees-id.
LOOP AT it_addrs.
IF it_addrs-type = ‘HOMEADDR’.
WRITE it_addrs-zipcode.
ENDIF.
ENDLOOP.
ENDLOOP.
Conceptual Level
Task: Get the id, name and the respective zip code of the home address for all
employees in org-unit 4711
Implementation level
Lifecycle Management
Consistent Lifecycle Management and CDS ABAP
extensibility as with all other ABAP
artifacts
(S)QL Engine
Highly reusable and extensible CDS
artifacts
DDL QL DCL
Data Definition Language Query Language Data Control Language
Data modelling and retrieval Consume CDS entities via Define authorizations for CDS
on a higher semantic level Open SQL in ABAP views
Extends native SQL means Fully transparent SQL Modelled and declarative
for higher productivity extensions approach
Integrates with classic
authorization concepts
Public
Types of CDS Built-in Expressions
Arithmetic Conversion
Functions Functions
String
Functions
Public
Code Push-Down with
Table Functions
Public
What do CDS Table Functions do?
But!
Database specific
Currently SAP HANA DB only
No automatic fallback for Any-DB
Public 27
Definition of a Table Function
PUBLIC SECTION.
Marker interface
INTERFACES:
if_amdp_marker_hdb.
Method name and link to CDS view
for signature inheritance CLASS-METHODS:
get_prime FOR TABLE FUNCTION zprimes_cds.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
Implementation is done
in a special tagged method
METHOD get_prime BY DATABASE FUNCTION
FOR HDB
Table functions are read-only LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
Used ABAP managed objects
USING zprimes.
ENDMETHOD.
USING zprimes_clnt.
ENDMETHOD.
Public
SQL Joins as Means for Combining Fields from Two or More Tables
Left
Outer Inner
Join Join
Filters can be used to restrict the result set when using [0..n] or [1..n] associations
Filters can be used to change the cardinality, e.g. in the WHERE clause only [0..1]
associations are allowed
Same filters can be configured to only generate a single join by using annotations
ABAP Code
SELECT FROM sepm_i_businesspartner
Association with leading backslash
FIELDS \_Address-PostalCode
INTO @DATA(result).
Associations can directly be used in Open SQL when using select on a CDS entity
They are translated into joins from the Open SQL compiler
Public
Extending Views
Public
Hierarchy of Views and Extensions
Basic View
B1
{
_Address.cityname
}
Public
Annotations
Public
CDS: Common Basis for Domain-Specific Frameworks
CDS
Efficient development
BI-Tools OData
Search
Annotations can be used to further enrich the meta model with consumer-specific vocabularies
Public
Authorizations with DCL
Public
Data Control Language Overview
Authorization CDS
Check View
<Code> <Code>
Scenario
Enable READ-access only to Sales Orders that belong to an Org Unit for which the user is
authorized (according to the PFCG authorization object)
CDS-View ( to be authorized )
Performance is critical
Rating
DCL Role
role DCL_SalesOrders {
grant select on SalesOrders
where (SalesOrg) = aspect pfcg_auth(S_SALES, ORGUNIT, actvt='03');
}
Open SQL Consumption
Performance: Only authorized entries are retrieved from the DB. Statement is
Rating not executed without authorization
Authorizations are only defined once and automatically (re-) used everywhere
Public
CDS Integration with Gateway and Service Adaptation Description
Language (SADL)
Contact information:
Martin Huvar
Product Management of SAP Technology Platform
martin.huvar@sap.com
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.
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. Please see http://global12.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices.
Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
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 SE or its
affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE 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 platform 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, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.