daniel ridder abap core data services no pain, no gain

16
ABAP Core Data Services No Pain, No Gain Hitchhiker's Guide to ABAP CDS since NetWeaver 7.40 SAP Inside Track 2017, Frankfurt Daniel Ridder @nielseabap

Upload: daniel-ridder

Post on 05-Apr-2017

255 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Daniel Ridder ABAP Core Data Services No Pain, No Gain

ABAP Core Data ServicesNo Pain, No Gain

Hitchhiker's Guide to ABAP CDS since NetWeaver 7.40

SAP Inside Track 2017, Frankfurt

Daniel Ridder @nielseabap

Page 2: Daniel Ridder ABAP Core Data Services No Pain, No Gain

What’s CDS?A beginners perspective

Page 3: Daniel Ridder ABAP Core Data Services No Pain, No Gain

ABAP Core Data Services

Technical Description

• Technologically agnostic definition of database views

• CDS borrowed heavily from SQL-Standard

• Supports functions of ANSI-SQL

• DDIC Object [DDLS] with can only be viewed and edited with ADT

• Generates database native artefacts (DDL-Statements) during activation

Context of Availability

• 1st introduction of CDS with NetWeaver 7.40 SP5 on AnyDB

• Parameter-Views came up with 7.40 SP8 (DBMS compatibility unknown at that time)

• General availability of CDS for AnyDB (incl. Parameter-Views) since NetWeaver 7.50

! DO NO MIX UP ABAP WITH HANA CDS !

It’s a total different technology

Page 4: Daniel Ridder ABAP Core Data Services No Pain, No Gain

What’s the idea?Accessing data

Programming model

Business Objects

Page 5: Daniel Ridder ABAP Core Data Services No Pain, No Gain

Back to good software design

Data access via OpenSQL Business ObjectsPerforming with itabs Abstraction via API-Design

Page 6: Daniel Ridder ABAP Core Data Services No Pain, No Gain

In the beginning the business object was created.This has made a lot of people very angry and been widely regarded as a bad move.

Persistance

Business Object

Attributes

Locking

Links to otherBusiness Objects

Access via API∙ BOPF∙ SADL∙ OpenSQL

• Don’t go back to the old days…

• 1st define your business object/data model

• Make it accessible via API

• OpenSQL is still an API, but…• do not code logic into the

statement

• use CDS Views instead– “The truth lays inside the views”

Page 7: Daniel Ridder ABAP Core Data Services No Pain, No Gain

Consumption and Use-Cases

• CDS may act as a read-only BO• Is the 1st choice for analytical

processes

• Enables full code pushdown of business logic to the database

• Can be consumed in different ways• ABAP• OData via Annotation or SAP Gateway• BEx BW Tools• …

CDS

Function

Module

SAP BW

VirtualProvider

SAP BEx Query

Business User

SAP BEx Tools

Fiori App SAP Gateway

ABAP

Floorplan Manager

No embedded BW in S/4HANA !

Page 8: Daniel Ridder ABAP Core Data Services No Pain, No Gain

CDS – phase of activationThere is a theory which states that if ever anyone discovers exactly what CDS activation does, it will instantly disappear and be replaced by something even more bizarre and inexplicable…

Page 9: Daniel Ridder ABAP Core Data Services No Pain, No Gain

Activation of a CDS Parameter-ViewHDB on NetWeaver 7.50 SP3

• There is no specification of SQL database views supporting parameters

• Due to this a parameter view becomes a complex native artifact

• A function object with a table as a result set has to be created

• On HDB the definition of the function is generated in SQLScript

Page 10: Daniel Ridder ABAP Core Data Services No Pain, No Gain

There is a theory which states that if ever anyone discovers exactly what CDS activation does, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

- There is another theory which states that this has already happened.

Activation of a CDS Parameter-ViewOracle on NetWeaver 7.40 SP11

Page 11: Daniel Ridder ABAP Core Data Services No Pain, No Gain

DROP TABLE "Z_DATATABLE“error in DDL statement for "Z_DATATABLE“SQL-error "-478-[IBM][CLI Driver][DB2] ALTER, DROP, OR REVOKE AFFECTING OBJECT TYPE FUNCTION CANNOT BE PROCESSED BECAUSE OBJECT SAPR3.Z_DATAVIEW OF TYPE FUNCTION IS DEPENDENT ON IT" in DDL statement for "Z_DATATABLE"

--------------- DB-ROLLBACK() ---------------

error in DDL, nametab for "Z_DATATABLE" not activated

…after activation on Oracle:

Here comes DB2 on zOS

Problem description

• Extending/Modifying a database table during SAINT yields to an upgrade error during activation phase

DBMS- specific Lifecycle management

Trans.Table

Trans.Table

CDS ViewW. Parameters

<dependency>

Unhandled dependencies between

native artifacts!

“[IBM][CLI Driver][DB2] SQL0101N The statement is too long or too complex.”

Page 12: Daniel Ridder ABAP Core Data Services No Pain, No Gain

The walk of painAvoid ABAP CDS in an heterogeneous DBMS landscape

Page 13: Daniel Ridder ABAP Core Data Services No Pain, No Gain

CDS on NetWeaver 7.40“The Walk of pain”

Dec 2015 Jun 2016 Nov 2016

2331160 - Renaming of CDS artifacts in customer systems

https://launchpad.support.sap.com/#/notes/2331160

Still 3x open incidents in systemupgrade process / SPAM breaks

• DB2/zOS• DB2• Upgrade-Performance

SAINT/SPAM breaks during activation phase• incorrect order of activation• wrong quantity of activation• problems with cyclic dependencies• problems after renaming of views• SELECT *

Problems while upgrading toNetWeaver 7.50:

• undocumented change of CDS specification (order of key attributes)

SAINT/SPAM breaks during activation phase• incorrect order of activation

Development Track

Page 14: Daniel Ridder ABAP Core Data Services No Pain, No Gain

Small selection of “hitting” notes

• Note 2240326 - Cycle problems during activation of CDS views• cycles are subject to “some restrictions” No documentation at that time

• Notes 2295005 - Data element change for table does not result in reactivation of all DDL sources during transport2381956 - Inconsistent 'SELECT *' CDS views2274996 - Problems with deletion of table or view fields with select * dependencies

• „Select-Star is for looser“

• Note 2239157 - Support of database features• „Official“ GA of CDS Views with parameters in NetWeaver 7.50 on AnyDBWhat about the introduction in 7.40 SP8?

• Note 2331160 - Renaming of CDS artifacts in customer systems• CDS Views could be renamed DDLS, CDS-Name, DDIC-Name (DDIC-Rename is always prohibited)

• Note 2387971 - Incompatible ABAP changes from Release 7.40 to 7.50• Since NetWeaver 7.50 all key attributes must be located together at the start of SELECT

Page 15: Daniel Ridder ABAP Core Data Services No Pain, No Gain

ABAP Core Data Services is a key technology

CDS goes further• CDS let you define a VDM – virtual data model

under S/4HANA (BO 1st)

• HDB supports the definition of ABAP CDS table functions

• Which solves a lack of AMDPs

• CDS Test Double Framework

• The upcoming S/4HANA programming model depends heavily on CDS Views

• The draft concept combines CDS and BOPF for transactional Fiori-Applications and is triggered by CDS annotations

Recommendations using CDSRecommendations based on our experiences:

• CDS > NetWeaver 7.40 > AnyDB• Do not built huge view hierarchies (< 5 level, not more

than 10 views)• Do not use parameters!• Avoid cycles in associations• Perform activation tests on each dbms target platform

• CDS > NetWeaver 7.50 > AnyDB• We will see…

• CDS > NetWeaver 7.50 > HANA• No restrictions

• CDS > NetWeaver 7.51 S/4HANA• rocks

Page 16: Daniel Ridder ABAP Core Data Services No Pain, No Gain

So Long, and Thanks for All the FishDaniel Ridder

@nielseabap