0% found this document useful (0 votes)
22 views36 pages

ABAP Rollout CDS View Entities ABAPConf

The document discusses the new generation of Core Data Services (CDS) views, specifically focusing on CDS view entities introduced in ABAP 7.55. It outlines the advantages of these entities over traditional DDIC-based views, including simplified definitions, improved performance, and enhanced architecture. Additionally, it covers the migration process from DDIC-based views to CDS view entities, highlighting the incompatibility and available tools for migration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views36 pages

ABAP Rollout CDS View Entities ABAPConf

The document discusses the new generation of Core Data Services (CDS) views, specifically focusing on CDS view entities introduced in ABAP 7.55. It outlines the advantages of these entities over traditional DDIC-based views, including simplified definitions, improved performance, and enhanced architecture. Additionally, it covers the migration process from DDIC-based views to CDS view entities, highlighting the incompatibility and available tools for migration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

ABAP Core Data Services:

A new generation of CDS views – CDS view entities


Andrea Schlotthauer, SAP
December 2022

Public
Agenda

Introduction Part I Part II Further information


Motivation & Migration from CDS
Advantages DDIC-based view to
CDS view entity
▪ Manual
▪ Tool-based

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 3


Public
Introduction
Introduction

CDS DDIC-based CDS view entity,


view, superseded by DEFINE VIEW
DEFINE VIEW ENTITY

Release Info, CDS view entity:


• ABAP 7.55
• Kernel Release 7.81
• ABAP Platform 2020
• ABAP Platform Cloud 2008

Source, Release Info: ABAP Keyword Documentation (sap.com)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 5


Public
Overview of CDS entities (ABAP Platform 2022)
CDS entity name Statement Purpose Status
CDS View Entity DEFINE VIEW ENTITY • Data selection Replacement for
• VDM interface view DDIC-based view
CDS Projection View DEFINE VIEW ENTITY • Exposing data of underlying
AS PROJECTION ON CDS view
• Top-most layer of a CDS data
model in the RAP context
• VDM consumption view
CDS Table Function DEFINE TABLE Select data with AMDP
FUNCTION functions (SAP HANA-native
functions)
CDS Hierarchy DEFINE HIERARCHY Hierarchy modeling
CDS Custom Entity DEFINE CUSTOM Implementing an unmanaged
ENTITY query, unmanaged RAP BO
CDS Abstract Entity DEFINE ABSTRACT Data type for RAP actions or
ENTITY functions
CDS DDIC-Based View DEFINE VIEW • Data selection Obsolete
© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC • VDM interface view 6
Public
Part l:
Motivation & Advantages
Motivation & Advantages

CDS DDIC-based view

CDS entity DDIC artifact

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 8


Public
Motivation & Advantages

CDS view entity

DDIC artifact

CDS entity

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 9


Public
Motivation & Advantages

No DDIC artifact
• Only ONE name for CDS view
entities (and not three names any
more)
• One object less that can become
inconsistent
• Faster activation

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 10


Public
Motivation & Advantages

Simplified definition, consumption & management


• View entities are represented adequately on SAP HANA database.
• Stricter syntax & semantic checks indicate problematic situations
more explicitly, for example, annotation checks.
• Automatic and implicit client handling.
• Obstacles have been removed (such as handling of CDS extends).
• Improved type safety within CDS expressions (typed literals and
stricter checks).
• Improved refactoring of view stacks.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 11


Public
Motivation & Advantages

Optimized CDS activation


• Significant performance improvements
▪ No CDS-managed DDIC views are generated
▪ Drastically simplified handling of CDS extends
▪ Example
View stack / scenario Activation time Activation time CDS
DDIC-based view view entity
10 / CREATE VIEW Stack 20,19 s 10,61 s
20 / CREATE VIEW Stack 40,56 s 21,37 s
10 / CHANGE FIELD 32,68 s 22,11 s
20 / CHANGE FIELD 68,88 s 48,09 s

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 12


Public
Motivation & Advantages

Improved architecture
• Checks of key elements
• Amount / quantity handling
• Improved buffer handling using CDS tuning objects

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 13


Public
Further information

• A new generation of CDS views: CDS view entities | SAP Blogs


• CDS view entities are feature complete. Overview of new features,
improvements, and differences | SAP Blogs
• Buffering CDS View Entities | SAP Blogs
• ABAP Core Data Services: New syntax for extending CDS entities |
SAP Blogs
• Feature Matrix: Data Modeling with ABAP Core Data Services | SAP
Blogs

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 14


Public
Demo
define view entity DEMO_VIEW_ENTITY_AS
with parameters
@EndUserText.label: 'Parameter for abap.int test'
p_abap_int4 : abap.int4
as select from sflight as a
inner join spfli as b on 1 = 1 -- literal on left side of ON condition
association to scarr as _scarr on 1 = 1 -- literal on left side of ON condition
{
key a.carrid,
b.deptime, -- prefix mandatory

//case expression with expressions and functions as operands


case cast( a.carrid as char3)
when substring( cast( 'AA' as char2), 1, 2) then 'American Airlines'
when substring( cast( 'LH' as char2), 1, 2) then 'Lufthansa'
else 'Others'
end as Airline,

//substring with session variable, parameter, and arith_exp as operands


substring( $session.user_timezone, $parameters.p_abap_int4,1*2) as Subs,

// complex case with expressions as operands and with new statement ELSE NULL
case when a.seatsmax * 2 = case 500 when 7 then 1 end
then 'x'
else null
end as Arith_on_left_side_of_case,

//new feature: typed literal


abap.dec'.15' as dec_literal
} where --where clause case and arith_exp as operands
b.distance * 5 = case a.price when 500 then 0 else 1 end

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 16


Public
CDS view entity extension

extend view entity DEMO_VIEW_ENTITY_AS with


{
_scarr
}

• No DDIC append view


• No name after WITH
• No dummy field required

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 17


Public
New feature: Calculated quantity with calculated unit reference

@AccessControl.authorizationCheck: #NOT_ALLOWED
@EndUserText.label: 'CDS view entity, calculated quantity'

define view entity DEMO_CDS_CALCULATED_QUANTITY


as select from demo_rent
{
key apartment_id as ApartmentId,
apartment_size as ApartmentSize,
apartment_unit as ApartmentUnit,
currency as Currency,

// currency field and unit field in arith expression


@Semantics.quantity.unitOfMeasure: 'calculatedUnit'
rent_decfloat34 / apartment_size as rent_per_size,
concat( concat(currency, '/' ), apartment_unit )
as calculatedUnit
}

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 18


Public
New feature: Calculated quantity with calculated unit reference

Data Preview:

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 19


Public
New feature: Entity buffer as separate CDS tuning object

CDS view entity that allows buffering:

@AbapCatalog.entityBuffer.definitionAllowed: true

define view entity DEMO_CDS_GEN_BUFFERED_VIEW


as select from sairport
{
key id as Id,
key name as Name,
time_zone as Time_Zone
}

Entity buffer:

define view entity buffer on DEMO_CDS_GEN_BUFFERED_VIEW


layer core
type generic number of key elements 1

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 20


Public
Part ll:
Migration from DDIC-based view to view
entity
Compatibility & Migration

Incompatibility by design
• CDS view entities by design incompatible to the existing CDS views.
• No automatic migration.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 22


Public
Compatibility & Migration

Helper tools

Tool name Technical name Available since


Program that lists RUT_WHERE_USE_S ABAP 7.57
usages of CDS- QLVIEW SAP Note 3201681
managed DDIC views (Downport for Releases
7.52 – 7.56)
Program for migration RUTDDLS_MIGRATIO
analysis N_CANDIDATES
Manual migration ABAP 7.56, ABAP
Platform 2021
Program for tool-based RUTDDLSV2MIGRATI
migration ON

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 23


Public
Compatibility & Migration

Usage of CDS-managed DDIC view


• RUT_WHERE_USE_SQLVIEW
• Downport for releases 7.52 – 7.56 as explained in SAP Note 3201681.
• Lists all usages of CDS-managed DDIC view in an ABAP system.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 24


Public
Compatibility & Migration

RUT_WHERE_USE_SQLVIEW

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 25


Public
Compatibility & Migration

Migration candidates report


• RUTDDLS_MIGRATION_CANDIDATES (since ABAP 7.56, ABAP
Platform 2021)
▪ Checks whether a view can be migrated to a view entity or not.
▪ Classifies the views into one of the following categories:
Migration not possible due to a technical constraint (e.g. DDLS name <> entity
name.
Migration possible with some potential behavior changes. Changes in the DDLS
source required.
Migration possible, some minor changes in the DDLS source might be required.

Video tutorial that demonstrates the migration analysis tool (0:56 min)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 26


Public
Compatibility & Migration

F1

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 27


Public
Compatibility & Migration

Manual migration (since ABAP 7.56, ABAP Platform 2021)


1. Check migration candidates with report
RUTDDLS_MIGRATION_CADIDATES.
2. Open the DDLS source in ADT.
a. Remove AbapCatalog.sqlViewName header annotation.
b. Add entity keyword.
c. Perform additional changes if required (prefixes, parameters,
annotations, …).
3. Activate the view entity in ADT. This last step will perform the
object type change from CDS view to CDS view entity.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 28


Public
Compatibility & Migration

Manual migration

CDS DDIC-based view CDS view entity

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 29


Public
Compatibility & Migration

Tool-based migration (since ABAP 7.56, ABAP Platform 2021)


• RUTDDLSV2MIGRATION
• An inactive version is generated by the tool. Last step (activation)
must be done by the developer.
• In case of issues, manual rework of the source.
• Reverse migration: open an incident on BC-DWB-DIC.

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 30


Public
Compatibility & Migration

Tool-based migration
• Steps of the migration tool:
▪ Initial consistency
▪ Precheck – same checks as migration candidates report
▪ Generate inactive version of the migrated DDLS (currently
more than 20 rules for adjustment)
▪ Check activation of the generated source
Embedded help: Execute RUTDDLSV2MIGRATION > More >
Program Documentation
Video tutorial that demonstrates the migration tool (1:51 min)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 31


Public
Demo
Migration Tool

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 33


Public
Further information
Further information

• ABAP Keyword Documentation on SAP Help Portal: ABAP Keyword Documentation


(sap.com)
• Blog post about the migration from CDS views to CDS view entities: A new generation of
CDS views: how to migrate your CDS views to CDS view entities
• Video tutorial that demonstrates the migration candidates tool (0:56 min)
• Video tutorial that demonstrates the migration tool (1:51 min)

© 2022 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 35


Public
Thank you.
Contact information:
Andrea Schlotthauer
[email protected]
Follow us

www.sap.com/contactsap

© 2021 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 w ithout the express permission of
SAP SE or an SAP affiliate company.
The information contained herein may be changed w ithout 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, w ithout representation or
w arranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions w ith respect to the materials.
The only w arranties 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
w arranty.
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
w ithout notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or
functionality. All forw ard-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 forw ard-looking statements, and they
should not be relied upon in making purchasing decisions.
SAP and other SAP products and services mentioned herein as w ell 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.

You might also like