Sie sind auf Seite 1von 66

DEV211 Core Data Services:

NextGeneration Data Definition and Access


on SAP HANA

Public

Disclaimer
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 SAPs 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.

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

Speakers
Las Vegas, Sept 19 - 23

Bangalore, October 5 - 7

Barcelona, Nov 8 - 10

Christian Stork

Raghuvira Bhagavan

Christian Stork

Andreas Grnhagen

2016 SAP SE or an SAP affiliate company. All rights reserved.

Andreas Grnhagen

Public

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS Views

CDS Table functions

Data Control Language (DCL)

i
2016 SAP SE or an SAP affiliate company. All rights reserved.

DEV267

Building Applications with ABAP Using


Code Pushdown to the Database

Public

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

Before CDS and modern Open SQL


1. Semantic gap between task and SQL Code
Task: Get the id, name and the respective zip code of the home address for all
employees in org-unit Development

Semantic gap

SQL:

SELECT e.id, e.name, a.zipCode


FROM Employee e
INNER JOIN
OrgUnit u ON u.id = e.orgid
LEFT OUTER JOIN Address a ON e.id = a.id
AND a.type
= HOMEADDR
WHERE u.name = Development.

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

Before CDS and modern Open SQL


2. SQL complexity leads to ABAP code in Application Server
Task: Due to the complexity of SQL, developers are using code instead of
SQL
Performance gap: nested loops and queries with many
round trips server - database

Code: SELECT

* FROM Employee INTO TABLE it_empl WHERE orgunit = 4711. I know 4711 is the
LOOP AT it_empl.
id of the dev unit
WRITE it_empl-id.
WRITE it_empl-name.
SELECT * FROM Addresse INTO TABLE it_addrs WHERE id = it_empl-id.
LOOP AT it_addrs.
IF it_addrs-type = HOMEADDR.
WRITE it_addrs-zipcode.
ENDIF.
ENDLOOP.
ENDLOOP.

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

With CDS and modern Open SQL:


Concept layer and implementation layer move closer
Task: Get the id, name and the respective zip code of the home address for all
employees in org-unit Development

Smaller semantic gap,

less code required

CDS:

SELECT id, name, homeAddress.zipCode


FROM OrgUnit[ name = Development ].employees

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

Next generation data definition and access for database centric applications

ABAP
CORE DATA SERVICES
</>
Common data model

Capture business intend

Improved programming model

Semantically rich

Reduced complexity

For all application domains

Declarative

Extending SQL

Rich set of build-in functions

Close to conceptual thinking

2016 SAP SE or an SAP affiliate company. All rights reserved.

Code pushdown capabilities

Public

Availability of CDS in SAP Platforms

ABAP CDS
SAP Business Suite EHP7 (Suite on HANA)

HANA CDS
SAP HANA SPS6

SAP NetWeaver 7.4 SP05


S/4HANA
SAP Business Warehouse 7.3

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

10

A family of domain specific languages

DDL

QL

DCL

Data Definition Language

Query Language

Data Control Language

Data modelling and retrieval


on a higher semantic level

Consume CDS entities via


Open SQL in ABAP

Define authorizations

Extends native SQL means for


higher productivity

Fully transparent SQL


extensions

2016 SAP SE or an SAP affiliate company. All rights reserved.

Modelled and declarative


(Re)use classic
authorization concepts

Public

11

Graph representation of a S/4HANA Development System

Data Model using the Association as Edges

[1]

12.239

22.847

724.656

CDS Views

Associations

Lines of Code
in CDS
Views

on 2016-04-26

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

12

ABAP integration
SAP NetWeaver ABAP

Infrastructure ensures Any-DB


support

OPEN SQL
CDS ABAP

Proven and consistent ABAP


Lifecycle Management and
extensibility
(S)QL Engine

Highly reusable and extensible CDS


artifacts
CDS also available in native
SAP HANA
2016 SAP SE or an SAP affiliate company. All rights reserved.

Lifecycle Management

Leverage DDIC semantics

Any SAP supported DB

Public

13

CDS development environment

01

Eclipse based
Part of ABAP
Development tools

02

Development tools
Code completion

03

Supportability
Enhanced data preview

Element info

Dependency analyser

Quick-Fix function

Activation graph

Syntax highlighting

Active annotations view


Unit testing

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

14

Demo

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

15

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

16

Code push-down with CDS and modern Open SQL


SCENARIOS

2016 SAP SE or an SAP affiliate company. All rights reserved.

CDSin
Build
Views
SQLand
Open
SQL
functions

Push non trivial


logic to any SAP
supported DB

Use natively
implemented SAP
HANA-DB functions

CDS
CDS Table
Table
Functions
Functions

Public

17

Open SQL: Modern syntax

What is selected?
What is name? Column or ABAP variable?

Target: Introduce expression in Open SQL


SELECT int_column1 int_column2 FROM db_table
INTO (result1, result2)
WHERE int_column2 + name = int_variable2.

leads to

Separate lists with commas


Escape host variables with @
INTO clause at the end

SELECT int_column1, int_column2 FROM db_table WHERE


int_column2 + @name = @int_variable2
INTO (@result1, @result2).

Old statements remain valid

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

18

Joins (CDS and Open SQL)


select * from
SEPMRA_I_Product_E
as Product
left outer join SEPMRA_P_OVW_DateTimeOffset as CurrentDateTime
on CurrentDateTime~CurrentDateTime is not null
left outer join SEPMRA_P_OVW_LastSaleD000
as LastSaleDate
on Product~ProductUUID = LastSaleDate~ProductUUID
where
LastSaleDate~LastSoldDateTime is null not sold at all
or LastSaleDate~LastSoldDateTime < CurrentDateTime~FourWeeksAgoDateTime
into table @data(result).

2016 SAP SE or an SAP affiliate company. All rights reserved.

Supported Join kinds:

Inner Join

Left Outer Join

Right Outer Join

Public

19

Union (CDS and Open SQL)


@AbapCatalog.sqlViewName: 'SEPM_PEMPHIER1'
define view SEPM_P_EmployeeHierarchy1 as select from SEPM_I_OrganizationalUnit {
key OrganizationalUnitUUID
as NodeUUID,
ParentOrganizationalUnitUUID as ParentNodeUUID,
OrganizationalUnit,
cast('' as abap.char(10) )
as Employee,
'19900101'
as ValidityStartDate,
'99991231'
as ValidityEndDate
}
union all
select from SEPM_I_EmployeeOrgAssignment
{
key EmployeeOrgAssignmentUUID as NodeUUID,
OrganizationalUnitUUID
as ParentNodeUUID,
''
as OrganizationalUnit,
_Employee.Employee,
AssignmentStartDate
as ValidityStartDate,
AssignmentEndDate
as ValidityEndDate
}

2016 SAP SE or an SAP affiliate company. All rights reserved.

Supported Union kinds:

UNION ALL

UNION ( DISTINCT )

Public

20

CASE (CDS and Open SQL)

@AbapCatalog.sqlViewName: 'sepmraovwlastsld'
define view SEPMRA_C_OVW_LastSaleDate
as select from
SEPMRA_I_Product_E
as Product {
key Product.Product,
-- enforce the default placeholder image as initial value for property ProductPictureURL:
case Product.ProductPictureURL when '' then '/sap/public/bc/NWDEMO_MODEL/IMAGES/no_photo.jpg'
else Product.ProductPictureURL end
as ProductPictureURL
}
where
LastSaleDate.LastSoldDateTime is null -- not sold at all
or LastSaleDate.LastSoldDateTime < CurrentDateTime.FourWeeksAgoDateTime

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

21

Session Variables (CDS) and concat (CDS and Open SQL)


@AbapCatalog.sqlViewName: 'SEPMRASOCUSTOMER'
define view SEPMRA_C_SalesOrderCustomer
as select from SEPM_I_BusinessPartner_E as BusinessPartner
{
key BusinessPartner.BusinessPartner,
concat(
concat(
concat( concat_with_space( BusinessPartner.StreetName, BusinessPartner.HouseNumber, 1 ),'\n'),
concat( concat_with_space( BusinessPartner.PostalCode, BusinessPartner.CityName, 1 ), '\n')),
BusinessPartner._Country._Text[1: Language = $session.system_language ].CountryName
) as Address
}

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

22

Views with Parameters (CDS Definition)


@AbapCatalog.sqlViewName:'SEPMRAIORGAKD'
define view SEPMRA_I_OrgAsgmntForKeyDate

with parameters
p_keyDate: abap.dats

as select from SEPM_I_EmployeeOrgAssignment_E as Assignment


association[0..1] to SEPMRA_I_Employee as _Employee on $projection.Employee = _Employee.Employee
association[0..1] to SEPMRA_I_OrganizationalUnit as _OrganizationalUnit on
$projection.OrganizationalUnit = _OrganizationalUnit.OrganizationalUnit
{
key Assignment.Employee,
key Assignment.ValidityStartDate
}
where
Assignment.ValidityStartDate <= $parameters.p_keyDate and
Assignment.ValidityEndDate
>= $parameters.p_keyDate

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

23

Views with Parameters (Usage)

@AbapCatalog.sqlViewName:'DEV211_V_PARAMS'
define view DEV211_E_PARAMS
with parameters @Environment.systemField: #SYSTEM_DATE p_keyDate: abap.dats
as select from SEPMRA_I_OrgAsgmntForKeyDate( p_keyDate : $parameters.p_keyDate )
{ * }

select from DEV211_E_PARAMS( p_keyDate = 20160926 )


fields *
into table @data(result)

select from DEV211_E_PARAMS(


fields *
into table @data(result)

2016 SAP SE or an SAP affiliate company. All rights reserved.

) use the default value sy-datum

Public

24

Built in SQL functions and expressions

Generic
Date / Time

Build in
SQL
functions

Arithmetic

Conversion

2016 SAP SE or an SAP affiliate company. All rights reserved.

String

Public

25

Supported functions and expressions for any DB


String

Arithmetic

Concat

Abs

Instr

Ceil

Left / right

Div (integer)

Length

Division (dec)
Generic

Floor

Simple- /

Mod

searched-case

Round

Coalesce

Conversion

Date / Time

Ltrim / rtrim

Days between

Replace

Add days

Unit conversion

Add month

Currency conversion

Current tmstp

Cast

2016 SAP SE or an SAP affiliate company. All rights reserved.

Lpad / rpad

Date is valid

Hex2Bin

Tmstp is valid

Bin2Hex

Seconds btw. tmstps

Decimal shift

Add seconds
Public

26

Demo

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

27

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

28

SQL Joins as Means for Combining Fields from Two or More Tables
define view zddl_join
as select from SEPM_I_SalesOrderItem as I

How we work with SQL joins

left outer join SEPM_I_Currency as C


on I.TransactionCurrency = C.Currency
{ }

Not reusable
Do not contribute to the data model

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

29

Associations as reusable relationships

Define Association with Cardinality


Use Association => select a column

define view zddl_assoc


as select from SEPM_I_SalesOrderItem
association [0..1] to SEPM_I_Currency as _Currency
on $projection.TransactionCurrency = _Currency.Currency
{
_Currency.CurrencyISOCode,

Expose Association for reuse

_Currency
}

Reuse association => select another


column

2016 SAP SE or an SAP affiliate company. All rights reserved.

define view zddl_use_assoc


as select from zddl_assoc
{
_Currency._Text[ language = 'EN' ] .CurrencyLongName
}

Public

30

Used CDS Associations - Translation into Joins


Where
Clause

Projection
List

Having
Clause

Group by
Clause

Left
Outer
Join

From Clause

Inner
Join

Used (!) associations are implicitly translated into SQL joins


Reuse of generated joins when semantically identical

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

31

Filter Expressions
define view zddl_bpa
as select from SEPM_I_BusinessPartner
{
_Address[1: Country = 'DE' ].CityName
}

Filter expression with cardinality


annotation

Restrict the result set when using [0..n] or [1..n] associations

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

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

32

Use associations in Open SQL from ABAP

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

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

33

Demo

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

34

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

35

Hierarchy of views and extension support

Consumer

Consumer

Consumer
C2

C1

View on View

C3

View on View

V1

Extensions

V2

&

Hierarchical view-on-view
concept
Optimized result-sets with
minimum data transfer
Append additional columns,
arithmetic expressions or
literals to result set

Basic View
B1

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

36

View extends
Extending view Business Partner

extend view SEPM_I_BusinessPartner


with zddl_bp_extend

Adding new field via association

{
_Address.cityname
}

Views can be extended to add additional fields


Extend is stored and transported in separate DDL source
Even union and group by clauses can be extended

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

37

Demo

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

38

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

39

Common basis for domain-specific frameworks

CDS ANNOTATIONS

Enrich meta model with consumer-specific vocabularies


Reusable and unified view model for all use cases
Enabling flexible usage in different contexts

Annotation query-api and annotation framework

Business
Logic

OData
Analytics

BI-Tools
Planning

2016 SAP SE or an SAP affiliate company. All rights reserved.

Search

Public

40

Annotations example

Some core annotations


Define access control means

@AbapCatalog.sqlViewName : ZDDL_ANNOTATIONS
@EndUserText.label: 'Business Partner with street'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view zddl_bpa
as select from SEPM_I_BusinessPartner

Domain specific annotation

{
@Semantics.address.street: true
_Address[1 : Country = 'DE' ].StreetName
}

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

41

Take Away Annotations

Separation of metadata and core data model

Allow applications to add their specific view


properties to the Data Model

Annotation allows
independency from Core Data Model
And can be defined at many view
parts!

Annotations can be defined for view header,


columns and parameters

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

42

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

43

Understanding SQL Processing Steps


HANA SQL Processor

SQL string

Logical Plan
Rewriting

Parsing

Result

select *
from T1,T2,T3,T4
where T1.A=T2.A
and T2.B=T3.B
and T3.C=T4.C
and T1.A = 100

select clause

J3

J3

J2

J5

J8

T1

J4

T2

T3

T1

T2

T1

T4

T3

J6

T4

Single logical plan

J3

J10
T2

J1

Runtime
Compilation

J2
J1

J1

1 Fix application (SQL)

Execution
Plan

J9

from clause

Get an Insights

T3

T4

Execution Plan
= Cached Plan
= Physical Plan

Logical plan forest


(= plan search space=alternative plans)

2 Fix data model


(via SQL hint)

J7

Cost-based
Best Plan
Selection

J2

where clause

3 Fix optimizers decision

Physical
Algorithm
Enumeration

Logical Plan
Enumeration

Visualize
via XML

Disable/enable/
visualize
rewrite rules
(what-if analysis)

Visualize
via XML

Change to alternative
plans and execute
(what-if analysis)

Visualize via XML


with execution
statistics

(hot-spot
analysis)

HANA PlanViz
2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

44

Performance
CDS Views && Open SQL are Code
Pushdown to the Database:
Performance strongly depends on the
database optimizer
Small changes can lead to
significantly different execution plans
on the database

Evaluate Performance with realistic


Data
2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

45

Demo

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

46

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS Views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

47

The need for CDS Table Functions

BREAKOUT SCENARIOS

Some scenarios require selective measure


Highest performance requirements e.g. with
complex calculations
Use of database / analytical engine specific
functions required
Open SQL and CDS views do not yet offer
functionality to solve the problem

2016 SAP SE or an SAP affiliate company. All rights reserved.

Database specific
Currently SAP HANA DB only
No automatic fallback
for Any-DB

Public

48

Necessary parts for CDS Table Functions


Runtime for table function

Table function definition

Runs stored SQL-script procedure


generated from AMDP on database
tables

Parameter list

Return Parameter
Reference to implementing method

DDL
Source

ABAP
Managed
Database
Procedure

SAP HANA
Database

AMDP Implementation
Includes SQL-script
function body

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

49

Table Function definition

Stored in a DDL source


List of input parameters
List of return parameters

Link to implementation

2016 SAP SE or an SAP affiliate company. All rights reserved.

define table function zprimes_cds


with parameters
rank : abap.int4
returns
{
prime_number
: abap.int4;
text_representation : abap.string;
}
implemented by method zcl_primes=>get_prime;

Public

50

AMDP implementation: ABAP class


Stored in a global ABAP class

Marker interface
Method name and link to CDS view
for signature inheritance

CLASS zcl_primes DEFINITION


PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES:
if_amdp_marker_hdb.
CLASS-METHODS:
get_prime FOR TABLE FUNCTION zprimes_cds.

PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

51

AMDP implementation: Tagged ABAP class method

Implementation in special
tagged method
Table functions are read-only
Used ABAP managed objects

Implementation in SQLScript

METHOD get_prime BY DATABASE FUNCTION


FOR HDB
LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
USING zprimes.
declare offs integer;
offs := rank - 1;
return select * from zprimes
order by prime_number
limit 1 offset :offs;
ENDMETHOD.

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

52

Usage of a Table Function

Table functions can be used


in Open SQL

Table functions work on


SAP HANA DB only

SELECT SINGLE FROM zprimes_cds( rank = 5 )


FIELDS *
INTO @DATA(prime)
##DB_FEATURE_MODE[AMDP_TABLE_FUNCTION].

Pragma confirms the successful


execution of a feature mode check
(See class cl_abap_dbfeatures)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

53

Agenda

Introduction
CDS Views and modern Open SQL in detail

Associations

Extending views

Annotations

Working with CDS Views

CDS Table Functions

Data Control Language (DCL)

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

54

Data Control Language Overview

CDS
View

</>

DCL

SQL

2016 SAP SE or an SAP affiliate company. All rights reserved.

</>

Public

55

Data Control Language Overview


Declarative approach instead of coded
Based on CDS modeling objects and
therefore part of the data-model

DCL approach

Classical approach

PFCG

PFCG

<Code>

<Code>
DCL

Authorizations are also pushed down


to DB by extending the Open SQL
SELECT statement

SQL

Authorization
Check

<Code>

2016 SAP SE or an SAP affiliate company. All rights reserved.

&

SQL

CDS
View

<Code>

Public

56

Usage of Declarative DCL Authorizations Example Scenario

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)

Check for authorization definition

@AbapCatalog.sqlViewName : SALESORDERS_V
@AccessControl.authorizationCheck: #CHECK
define view SalesOrders as select from SalesOrder_Table
{
key SalesOrder as SalesOrderNumber,

CDS-View ( to be authorized )

GrossAmount,
SalesOrg, // This is the field which is relevant for the authority check
_Items,
_Buyer
}

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

57

Classic authority checks


SELECT * FROM SalesOrders INTO CORRESPONDING FIELDS OF
@wa_SalesOrder.
AUTHORITY-CHECK OBJECT 'S_SALES'
ID 'ORGUNIT' FIELD wa_SalesOrder-SalesOrg
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 0.
APPEND wa_SalesOrder TO lt_SalesOrders.
ENDIF.
ENDSELECT.

Coded authority check

Rating

No reuse
Every access to the view has to be secured separately

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

58

Usage of DCL authorizations DCL role and consumption


DCL role

role DCL_SalesOrders {
grant select on SalesOrders
where (SalesOrg) = aspect pfcg_auth(S_SALES,
ORGUNIT, actvt = '03');
}
SELECT * FROM SalesOrders
INTO CORRESPONDING FIELDS OF TABLE @lt_SalesOrders.

Open SQL Consumption

Rating

Performance: Only authorized entries are retrieved from the DB.


Statement is not executed without authorization
Authorizations are only defined once and automatically
(re-) used everywhere
Works only for the defined entity

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

59

Usage of DCL authorizations SQL translation


DCL role

Open SQL Consumption

SQL Translation
Retrieved from the user context

2016 SAP SE or an SAP affiliate company. All rights reserved.

role DCL_SalesOrders {
grant select on SalesOrders
where (SalesOrg) = aspect pfcg_auth(S_SALES,
ORGUNIT, actvt = '03');
}
SELECT * FROM SalesOrders
INTO CORRESPONDING FIELDS OF TABLE @lt_SalesOrders.

SELECT * FROM /* Entity Name: SalesOrders */ SALESORDERS_V SALESORDERS


WHERE SALESORDERS.CLIENT = 000 AND
SALESORDERS.ORGUNIT IN ( 0001, 0002 )

Public

60

Core Data Services and Modern Open SQL at a Glance

1
2
3

Semantically Rich Data-Models


Domain specific languages (DDL, QL, DCL)

Declarative, close to conceptual thinking

CDS is completely based on SQL


Any Standard SQL features directly available
like joins, unions, build-in functions,

Fully Compatible with Any DB


Generated and managed SQL Views
Modern Open SQL

2016 SAP SE or an SAP affiliate company. All rights reserved.

4
5
6

Common Basis for Domain-Specific


Frameworks e.g. UI, Analytics, Odata, BW,
@AnalyticsDetails.aggregationBehaviour: SUM

Built-in Functions and Code Pushdown

Table Functions for Breakout Scenarios


Rich Set of Built-in SQL Functions

Extensible

On model level through extensions


On meta-model level through annotations

Public

61

Questions &&
Answers
Public

SAP TechEd Online


Continue your SAP TechEd
education after the event!
Access replays of
Keynotes

Demo Jam
SAP TechEd live interviews
Select lecture sessions
Hands-on sessions

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

63

Further information
Related SAP TechEd sessions:
DEV267 - Building Applications with ABAP Using Code Pushdown to the Database
DEV109 - The ABAP Programming Model in SAP S/4HANA
DEV212, DEV268 - Building an End-to-End SAP Fiori App Based on SAP S/4HANA and ABAP
DEV265 - ABAP Today
DEV266 - Code Better with ABAP in Eclipse

SAP Public Web


scn.sap.com/community/developer-center/
scn.sap.com/community/abap-for-hana
scn.sap.com/docs/DOC-59038 (ABAP for SAP HANA Reference Scenario - Tutorials)

SAP Education and Certification Opportunities


www.sap.com/education
open.sap.com (e.g. ABAP Development for SAP HANA: https://open.sap.com/courses/a4h1 )

Watch SAP TechEd Online


www.sapteched.com/online

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

64

Feedback
Please complete your
session evaluation for
DEV211

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

65

2016 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.
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://www.sap.com/corporate-en/about/legal/copyright/index.html for additional trademark information and notices.
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 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 SEs 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 forwardlooking 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.

Some pictures used in this presentation have been made available on the web page www.pexels.com under a Creative Commons Zero (CC0) license,
https://creativecommons.org/publicdomain/zero/1.0/

2016 SAP SE or an SAP affiliate company. All rights reserved.

Public

66

Das könnte Ihnen auch gefallen