ABAP Core Data Services
SAP Business Suite — Best Practice Guide
PUBLIC.
Document Version: July 9, 2019
EP run simple‘www.sap.com/contactsap
‘neo wT Senay oaescein wa SkP ke erie ope sre mp sine anaes Benen a otom reser
SARA SimpleTABLE OF CONTENTS
CONTRIBUTORS.
Authors
Acknowledgements.
Feedback Welcome
INTRODUCTION ene
What's new about ABAP Core Data Services...
About this Guide..
ABAP CORE DATA SERVICES.
Availability and Core Capabilities.
CDS features vs. SAP Releas:
Documentation Links
Development Framework wnnmm
Services Based on CDS Views
SAP Applications using CDS
BEST PRACTICES won,
SAP Applications...
Custom Applications..
Development Rules and Governance.
Performance Safeguarding.
DATABASE SPECIFICS.....
General Remarks
IBM Db? for i. ene
IBM Db? for Linux, Unix and Windows.
IBM Db2 for z/OS.
Microsoft SQL Server...
Oracle Database.nnnnn ssnsennnnnsnne
SAP Adaptive Server Enterprise (SAP ASE).
SAP HANA DBs
SAP MaxDB.
35
TRAINING
APPENDIX.
List of changes wenn
ReferencesCONTRIBUTORS
Authors
Coordination
Sr nd kohler @sap
eee ont Berd Kohler bernd kohler@sap com
SAP NetWeaver ABAP_| Gaspar Zoltan Erdelyi| gaspar zoltan
[email protected]
Performance Randolf Ellenberger_| randott
[email protected]
Dorothea Stein
[email protected]
IBM Db2 fori
Christian Bartels __|
[email protected]
Thomas Rech
[email protected]
IBM Db2 for Linux, Unix
Oe Nene Dirk Nakott nakott@ide ibm.com
Kari Fleckenstein | karl
[email protected]
IBM Db2 for 2/08 Bamd Kohler bornd,
[email protected]
Microsoft SQL Server_| Tino Rosenkranz __| tino,
[email protected]
Matthias Lienert
Oracle Database
Patrick Kolb patrick
[email protected]
‘SAP Adaptive Sorvor
SAP Adar Andreas Fischbach |
[email protected]
‘SAP HANA DB. Irona Kolman
[email protected]
“Thomas Elvors
SAP MaxDB
Torston Pitfor
Acknowledgements
‘The authors would like to thank the following SAP colleagues for their valuable contributions:
+ Timm Falter
Frank Hoffmann
Jorg Meier
* Carine Tehoutouo Djomo
Feedback Welcome
‘ABAP Core Data Services (CDS) is stil a rather new technology. Therefore, this guide is “work in progress”
and an update will be published regularly
You can help improving the content. We are looking forward to any type of feedback: questions, corrections,
technical insights, problem cases, user experiences, or requests for additional topics to be covered,
Please, send your comments directly to bernd,
[email protected]!INTRODUCTION
What's new about ABAP Core Data Services
‘ABAP Core Data Services' (CDS) is a data dictionary infrastructure that was introduced with SAP
NetWeaver 7.40. It allows for defining and consuming semantically rich data models. The underiying
principles are depicted in Figure 1
Application
Classic Approach Data Centric Approach
‘Avoid costly computation on Gat the algorithm to the data
detabase level ‘Only transfer computation
Transfer data to application results to the application
server and compute there server
Figure 1: Principles of ABAP Core Data Services
Without CDS (labelled as “Classic Approach” in Figure 1), intensive calculations are done on the application
layer avoiding costly computations in the database. This results in rather simple SQL queries between
application and database layer. The drawback is however that lots of data needs to be transferred back and
forth between those two layers. Often, this is very time-consuming
CDS allows for a data centric approach. Intensive computations are pushed into the database by using
complex views and functions (see Section “CDS features vs. SAP Release" on page 7). Depending on the
se case, this may dramatically reduce execution time and simplify application coding as compared to the
traditional approach (especially for calculations that are close to the data, by reducing the data volume of
‘communication between the application server and the database),
About this Guide
Purpose
The CDS framework was initially introduced to leverage the computational power of HANA DB.
Nevertheless, it can also be used with all other databases that support SAP NetWeaver. This guide gives
hands-on information on how to implement, run and optimize CDS based applications on various database
products.
7 ABAP Core Data Services should not be mixed up with SAP HANA Core Data Services. The latter serve
to build design-time data-persistence models in SAP HANA Extended Application Services (SAP HANA XS)
= for both XS classic and XS advanced models (see httos://help.sap.com/viewer/search?q=hana%20cds).A great deal of online documentation covering CDS is already available. Whenever possible, the guide will
reference these sources rather than replicate the related information
Note that some links are only accessible with an SAP User Account (also known as S-user ID). SAP
administrators in your company are usually able to provide one (without additional privileges).
Audience
This document is useful for the following audience:
+ ITarchitects - to design CDS based applications (data structure, database layout, queries, etc.) and
guideline application development
+ Application developers — to understand database capabilities and potential limitations related to CDS
+ SAP Basis administrators ~ to ensure the required SAP maintenance level
+ Database administrators — to provide the correct database maintenance level and optimize the
database performance
Scope
The following database products supported for SAP Business Suite are covered:
© IBM Db2 for i
IBM Db? for Linux, Unix and Windows
IBM Db2 for 2/08
© Microsoft SQL Server
* Oracle Database
* SAP Adaptive Server Enterprise (SAP ASE)
+ SAP HANA DB
© SAP MaxDB.
Many technical details and recommendations apply to all database types. Individual information is covered in
Section "Database Specifics” (page 16i.)
Structure and Content
‘The guide is made up of three parts:
4) Section "ABAP Core Data Services” provides a technical overview and describes the CDS framework. In
addition, it ists some of the services provided on top of CDS and shows how itis used in SAP
applications.
2) Section “Best Practices” gives general recommendations on how to deal with CDS within SAP solutions
and home-crown applications.
3) Section “Database Specifics’ lists database specific recommendations and requirements when using
CDS. Maintenance levels, settings and tuning measures are clarified.ABAP CORE DATA SERVICES
Availability and Core Capabilities
ABAP CDS became available first with SAP NetWeaver 7.4 SPOS. Its benefits can be summarized as
follows:
4) Semantically rich data-models — is deciarative and close to conceptual thinking (refer to
https:/tinyurl,com/SAP-ABAP.CDS-Date-Model for details)
2) Completely based on SQL - offers many standard SQL features like joins or build-in functions
3) Compatible across databases — is available with all database products that support SAP NetWeaver
7.40 and higher
4) Annotations - supports domain-specific annotations which can be easily evaluated by other components,
such as Uls, analytics, or OData services
5) Associations — enables simple definition of views on top of views and path expressions to navigate
along relations
6) Extensibility — allows simple extension of CDS views with fields either on model level through extensions
or on meta-model level through annotations
‘A detailed introduction to ABAP CDS is available at httos:/tinyurl.com/SAP-ABAP-CDS- Introduction,
CDS features vs. SAP Release
Many CDS specific enhancements have been added to SAP NetWeaver after the framework was initially
released with SAP NetWeaver 7.40 SPOS, among them:
+ SQL joins: INVER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN, CROSS JOIN
+ SQL SET operations: unrow, UNTON ALL.
+ SELECT clauses: WHERE, GROUP BY, HAVING, AS
* Literals, arithmetic operators, conditional exoressions: +,
* Aggregate functions: ave, MAX, NEN, SUM, COUNT
+ Numeric functions: CEL, Noo, A85, DIV, DIVISION, FLOOR, ROUND, FLTP_TO_DEC
String functions: sussTRING, LP&D, CONCAT, CONCAT_WITH_SPACE, REPLACE, INSTR, LEFT, LENGTH, LTRIM, RIGHT,
RPAD, RTRIN, UPPER, LOWER
+ Byte string functions: BINTOHEX, HEXTOBIN
+ Date and time functions: DATS_DAYS_BETWEEN, DATS_ADD_DAYS, DATS_IS_VALID,
‘© Special functions: CAST, COALESCE, CURRENCY CONVERSION, UNIT CONVERSION, DECIMAL, SHIFT, —
7. NOT, AND, OR, BETWEEN,
+ Session variables: Ssossion.user, $sossion.cliont, Ssossion.systom date,
‘The following blog provides an excellent overview about the availability of certain features:
hitps:/tinyur. com/SAP-ABAP.CDS-Featuro-Matrix
SAP Help Portal also serves as a comprehensive source of information (see table below):Documentation Links
740 [ERPGEHP 7 | nvutlcom/SAP-ABAP-CDS.Docu-740
ERP 6 EHP 8
x50 |Barkna Servees@ /SAP-ABAP.CDS-Docu miSAPABAE a
12
7st {nyu comiSAP-ABAP.CDS.Decu-751 | inyucom/SAP-ABAP-CDS.Newin-751
752 nyu com'SAP-ABAP.CDS-Docu-752 | nurcom'SAP-ABAP.CDS.Now.in-752
Development Framework
CDS views are developed and maintained in ABAP in Eclipse (see Figure 2) whose textual editor provides a
rich feature set for fast development including
* Code completion
+ Data preview
# Quickefix function
+ Syntax highlighting
+ Dependency analyzer
+ Display of CREATE statement
Figure 2: ABAP in Eclipse development framework
‘There is lots of information available on how to develop CDS based applications by using the ABAP in
Eclipse framework. Refer to the following links:
* Configuration: hito:/help sao. comdownloadinetveaverladt'SAP ADT Configuration Guide Backend en.odf
+ Guides:
—_ https:/tinyurl.com/SAP-NW750SP15.CDS-User-Guide
—_ htlps:/tinyurl,com/SAP-NW750SP15-ABAP-in-Eclipse
* Tutorials:
- m developeri - rl
— https:/iwny.sap.com/developeritutorials/abap-create-project htm!—_ https:/wv.sap.com/developeritutorials/abap-dev-adt.create-cds-view.htm!
hitps://blogs.sap com/2016/09/26/core-cata-services-cds-in-sap-s4-hana
Services Based on CDS Views
The full potential of the CDS framework is only realized by using the services built on top of it. The following
sections serve as an introduction to some of them.
OData Clients
CDS views can be easily exposed via OData by adding annotation @0Data. publish: true to the view
definition. Figure 3 illustrates the components that participate in the exposure process. The view activation
process generates several service artefacts. Subsequently, these services are added to the SAP Gateway
service catalog (using transaction /IWFND/MAINT_SERVICE) and become thus available for consumption by
an OData client (¢.g. an SAP Fiori app).
SAP Gateway Hub
acthate saree
[AS ABAP Backend Systm
ABAP Development Tool i}
Figure 3: Components and activities when exposing CDS views to OData
More information is aveilable here:
* https:/itinyurl.com/SAP-ABAP-CDS-and-ODate
© https /blogs sap.com/2015/04/20/creating-odata-services-out-of-cds-views
* https /iblogs.sap.com/2018/08/13/beauty-of-odata
SAP Fiori
Based on the OData exposure of CDS deseribed above, itis then rather straightforward to create an SAP
Fiori app using the development framework SAP WEB IDE (either locally or within SAP Cloud Platform). AS
depicted in Figure 4 the SAP Fiori User Interface connects to SAP Gateway using the OData services,WW
‘SAP Fo User nee
Fe Sar Tor
Figure 4: CDS consumption by SAP Fiori - architecture overview
A detailed step-by-step description on how to create such an app Is provided here:
1. https:/tinvurl.com/SAP-ABAP-CDS.Create-Fiori-Apo1
2. https:/itinvurl,com/SAP-ABAP-CDS-Create-Fiori-Apo2
Lots of information is available at the SAP Community Wiki for SAP Fiori
* https:/iwiki sen.sap.comiwiki/display/Fior/All+Things*SAP-+Fiori
SAP BusinessObjects Analysis for Microsoft Office
SAP BO Analysis for MS Office is @ business intelligence (B!) and multidimensional data analysis software.
It allows to filter and manipulate data, to identify trends and outliers right within Excel, and to share findings
in live PowerPoint presentations (Figure 5 shows an example)
Figure 5: Analysis for Microsoft Office with Excel and PowerPoint
CDS views can easily be added as @ data source, for more information refer to:
+ _https:/iblogs.sap.com/2017/05/12/consumption-of-cds-views-in-analysis-for-office
10*https:/itinyurl.com/SCN-Analysis-for-MS-Office (Product tutorials)
BW Context
ABAP CDS views can also be used within an SAP BW context.
Refer to the following link for details: httpsy/tinyurl.com/SAP-ABAP-CDS-and-BW
SAP Applications using CDS
There is a variety of SAP applications based on CDS. The following sections gives a brief overview (without
claim of completeness).
ERP 6.0 EHP8
The latest version of SAP ERP, which is SAP ERP 6.0 Enhancement Pack 8, is delivered with more than
2300 CDS views. One of the ERP components that benefit from using CDS views is for instance SAP
Commodity Management (see httos:/tinyurl, con/SAP-Commodity-Mamt-608SP12).
Repid Replenishment Planning
Replenishment is a method of supplying recipients (sites or external customers) with merchandise on a
demand-driven basis. In replenishment planning, requirements are calculated using the current stock
situation, Once this has been done, follow-on documents (for example, purchase orders or sales orders) are
generated for the supply of merchandise.
In rapid replenishment planning, the system uses an optimized method for determining the required
elements (stock, forecasts, receipts/issues) and calculating the required quantity. It enables — depending on
the database system used, and the concrete attributes of the planning run — a significant runtime saving in
comparison with classic planning.
For details refer to SAP Note 2051280 and https:/tinyurl.com/SAP-Retail-Rapid-Replenishment.
Convergent Invoicing
SAP Convergent Invoicing is a finance application that integrates the following applications:
* SAP Convergent Charging (see https://tinyurl.com/SAP-Convergent-Charging
+ SAP CRM (see httosv/tinyurl.com/SAP-Customer-Relationship-Mamt
+ SAP Contract Accounts Receivable and Payable (see httos:/tinyurl.com/SAP-Contract-Accounts-R-P)
The comprehensive integration enables business processes from the consuming a service through pricing
and billing right up to dispatching of the invoice to the customer.
On the front-end site, SAP Convergent Invoicing exploits SAP Fiori. On the backend, complex queries are
executed,
coms Chen rene mans
Contract
Ear a) —
Figure 6: SAP Convergent Invoteing
More information is available at; hitpsi/tinvurl,com/SAP-Convergent-Invoicing-61812
"Banking Services from SAP
SAP banking services from SAP 9.0 provides a variety of new Fiorilike apps. Two of those apps heavily rely
on CDS implementations:
* Get Bank Customer Overview (see https:/tinyurl,com/Get-Bank.Customer-Overview
* Manage Time Deposits (see https:/tinyurl,com/Manage-Time-Deposits)
12BEST PRACTICES
SAP Applications
SAP applications using CDS views ere extensively checked and tested on your database by SAP before
being released and shipped. So, the related transactions run out-of-the-box.
In adition, we recommend the following:
4) Check the database: Lift the underlying databases to the minimum versions and patch levels specified in
Section “Database Specifics" (page 16ff.). Also, ensure that the database settings are according to the
recommendations mentioned there.
2) Check SAP Release Notes: There is database related information available for some SAP applications
using CDS views, See Section “SAP Applications” (page 16) for details.
3) Update the SAP Patch Level: Apply all SAP Patches and Notes recommended for your database. Refer
to Section “Database Specifics’ (page 16ff.) for details.
4) Keep an eye on CDS based workload: Regularly monitor the performance and workload impact of CDS
based applications, e.g. by using the ABAP SQL Monitor (see https:/tinvurl,com/ABAP-SQL-Monitor)..
5) Establish a remote support connection: In case SAP support is needed for the analysis of CDS related
problems, the required support infrastructure should already be in place. Refer to Section “Incident
Support” (page 16) to set it up.
In case of performance issues, refer to the database specific "Tuning Measures’ within Section "Database
Specifics” (page 16ff.). If that falls open an incident using component HAN-DB (for HANA DB) or BC-DB-
, DBA, DBE, MISS, ORA, SDB, SYB).
Custom Applications
‘The benefits of the CDS framework laid out in Section “ABAP Core Data Services” (page 7) are by no means
only restricted to SAP applications. For customers, home-grown applications are an essential part of their
SAP related portfolio and workload. Many of these apps could significantly benefit from using CDS features
For custom development, the following recommendations apply
41) Start small: It is important to gain in-house experience with the “new” database centric development
model as well as the performance and life-cycle management of CDS views. Therefore, start with a small
project that does not affect business critical transactions and gradually expand the footprint of CDS within
your SAP landscape.
2) Check the database: Lift the underiying databases to the minimum versions and patch levels specified in
Section “Database Specifics” (page 16ff.). Also, ensure that the database settings are according to the
recommendations mentioned there.
3) Update to SAP NetWeaver 7.50: Although CDS has been made available already with SAP NetWeaver
7.40, its advisable to have your SAP landscape updated to SAP NetWeaver 7.50 (which corresponds to
Business Suite 6 Enhancement Pack 8) before starting CDS based developments. Also, apply all SAP
Patches & Notes recommended for your database; refer to Section “Database Specifics” (page 16ff.) for
details.
4) Implement a governance process: To avoid any surprises once CDS views have arrived in the
productive environment, you should establish clear rules and checks for the development process. More
details are covered in Section "Development Rules and Governance” (page 14).
5) Ensure quality assurance: Testing with realistic data on all database types present in your SAP
landscape is a must for newly developed CDS-based applications
6) Keep an eye on CDS based workload: Regularly monitor the performance and workload impact of CDS
based applications, e.g. by using the ABAP SQL Monitor (see hitps:/tinyurl.com/ABAP-SQL-Moniter).
7) Establish a remote support connection: In case SAP suppott is needed for the analysis of CDS related
problems, the required support infrastructure should already be in place. Refer to Section “Incident
Support” (page 16) to set it up.
13In case of performance issues, refer to the database specific “Tuning Measures’ within Section “Database
Specifies” (page 16ff.)
Development Rules and Governance
This section lists recommendation on how to pursue in-house application development (also known as
“custom development’) using CDS capabilites.
‘The CDS development framework offers enormous possibilities. However, the laws of physics and computer
science still apply.
‘Therefore, we advise to stick to some basic development rules:
1. General Rule
Use SQL best practices when using CDS views,
2. OLTP and OLAP
‘Separate data models for analytic and transactional purposes.
3. DB Limits
Pay attention to database limits (Section “Database Specifics 16ff.)
4. Complexity
* Build entity-relationship models before defining CDS views.
+ Restrict the complexity of CDS views depending on their usage:
Within business logi of high-
‘ volume transactions s3 ite Ne Ne
2 Wii business toe of <5 [Ontyforeout Jy, No
3 Within Ulfor single objectretreval |<10__[Yes Yes No
4 Analytical reporting Open [Yes Yes Yes
+ Avoid cyclic references in the definition of CDS views (to =)
prevent problems during activation). @ &
5. Performance ©
+ Create indexes on base tables to enable index-only access (not relevant for HANA DB).
* HANA only: For secondary indices on HANA refer to SAP Note 1794297. Additional indexes can be
helpful in tables with many entries (> 1 milion) for selective fields that are used as filter of frequently
executed queries. HANA secondary indices are predominantly single column indices.
+ SFIN on HANA only: Avoid access to compatibility views for performance-intensive applications (if
runtime is critical or if frequently executed).
* Avoid calculated fields in WHERE-clauses and ON-clauses of CDS views, especially when tables with many
entries are involved. Calculated fields result from functions like string functions (CONCAT, RTRIM, ...). For a
calculated field to be used (as filter or join condition) the values of this field for every row must be
evaluated at this point of processing. That may be very time-consuming.
4* Avoid constants in ELSE branches within CASE especially for views to be reused in joins as it potentially
limits DB optimization due to not preserving the null value. The same limitation applies to fields defined as
constant if the view in which they are defined is on the right side of a LEFT OUTER JOIN.
* Avoid cyclic associations or cyclic joins with involvement of left outer join, especially when tables with
many entries are involved,
+ To achieve a certain business purpose, choose the simplest CDS view possible. Do not create the all-in-
one complex view covering all demands.
‘+ Use associations to improve performance: If they are just defined and exposed within the projection lis,
they are pure metadata; only if used in @ path expression they become standard joins,
+ ICDS views contain LEFT OUTER JOIN relationships between tables, use the MANY TO ONE clause if
possible, Check if UNION clauses could be safely replaced by UNION ALL without changing the semantics.
6. Life-cycle management
+ Ensure an identical SAP maintenance level on all involved SAP systems (development, Q&A,
production).
* Do not rename generated views after their release to the SAP landscape.
7. Approval Process
Review your approval processes before starting CDS based development,
Consider the following
* Communicate the development rules lined out in this section.
* Review and approve complex CDS hierarchies before releasing them to the SAP landscape.
* Ensure that new CDS workloads do not impair important business processes in the same system (review
of workload management, capacity planning, etc.)
Performance Safeguarding
In case of performance issues related to the database refer to the database specific “Tuning Measures’
within Section "Database Specifics” (page 16ff.)
“The following blogs introduce into the performance of CDS views especially on HANA DB and described how
to safeguard tt:
«https ://blogs.sap.com/2018/03/02/performance-of-abap-cds-on-sap-hana-at-sap-teched-2017
«tips /tinyur.com/1-CDS-View-Gomplexity
+ hiipsitinyurl com/2-SOL-Optimizer-Plan-Cache
«https /tinyurl.com/3-Rules-for-Good-Performance
Many recommendations given in these blogs are also valid for the row-basad database types supported by
SAP, i. IBM Db2, Oracle, MS-SQL, SAP ASE & SAP MaxDB.
18DATABASE SPECIFICS
General Remarks
Hardware Requirements
Standard sizing with SAP Quick Sizer applies. CDS views may pose rather individual memory and CPU
requirements to the infrastructure depending on their complexity and the data volume. Tuning can only be
done hands-on. Refer to the DB specific Sections "Tuning Measures” for hints on how to improve the
performance of CDS based queries.
SAP Applications
Database specific information is available for CDS enhanced SAP applications. Please, refer to the notes
listed below:
2051280 | Rapid replenishment planning
2425167 | Usage of account search in Fiori app for banking services from SAP - performance on different data bases
Usage af businass partner search in Fiori apps for banking services from SAP - performance on different
2429180 | data bases
2311347 | Database-Related Performance Information for Snapshot-Based Mark-to-Market Reporting
2136479 | Database-Specific Information for SAP Convergent Invoicing
General Notes
‘Support of database features
Life-Cycle Management
The following recommendations apply if you plan to migrate an SAP system with self-defined CDS views to a
different database:
* Check the notes listed above in Sections “SAP Applications” and "General Notes” for remarks relevant for
the target database.
* Vorify that all self-defined CDS views in the source systems comply to the limitations of the target
database (see the databases specific Sections “DB Limits" below),
* Perform a proof-of-concept migration of the productive system and check the performance of all custom
applications based on CDS views,
Incident Support
In case of persistent database issues with a CDS Query, create an incident in the appropriate SAP database
component HAN-DB (for HANA DB) or BC-DB- (=D82, DB4, DBS, ISS, ORA, $08, $¥8).
For analyzing CDS related issues, an SAP R/3 standard support connection is not enough as access by
ABAP Development Tools outside the SAPGUI are required. To ensure that SAP support has full access to
the system for problem determination, enable one of following remote access options:
+ WTS Connection to a desktop with the ABAP development tools installed
16* R/S Support and SAP NI Connection to allow remote connection of ABAP Development Tools by SAP
Service or Development staff
Details on SAP service connections are available at https: /tinyurl,com/SAP-Remote-Service-Connections.
Also, ensure that support users are authorized to execute the following transactions:
DBACOCKPIT, STO4
* SOLMD
© STON
© SAT, ST05, ST12
For HANA DB, the authorization for transaction DBACOCKPIT in combination with STOS and ST12 is
particularly helpful because it allows PlanViz files to be saved — in case Plan Visualizer (PlanViz) is enabled
in the system,
7IBM Db2 for i
DB Levels
We recommend that you use IBM i 7.2 or higher to get the best possible performance. In general, applying
the product temporary fixes (PTFs) listed in the IBM Info APAR for SAP for your database release will ensure
that you have all PTFs that are recommended to run SAP. You can use the health check functionality of
report RSDB4CDSTOOLS to check for individual PTF beneficial to run CDS. Those include fixes to known bugs
a well as performance features like LEFT OUTER TO ONE JOIN, table function inlining, LIMIT ~ OFFSET, and
others. All PTFs are also listed in SAP Note 2075068 ("IBM i: Overview of CDS on DB2 for IBM i
\pMi7.2_| 2075088 | SAP Support Required PTF List for |BMi 7.2
'eMi7.3_| 2075068 | SAP Support Required PTF List for |BMi7.3,
iemiz.4 | 2075068 | SAP Support Required PTF List for IBM7.4
DB Settings
IBM Db2 for iis offering a variety of tools and advanced tuning measures that can help to speed up the
‘execution of specific CDS queries. Among those are:
‘* IBM i Access Client Solutions (ACS) is a Java based platform-independent too! that you can download
to your workstation from this link: https://www.ibm.com/systems/power/software/i/access/solutions.htm!
With ACS, you can connect to any IBM iserver in your landscape and perform administrative tasks. For
IBM Db2 for i, the tool offers options to work with database objects in schemas, run SQL scripts and
analyze the database performance. You can also configure the plan cache size with this tool. IBM i
‘Access Client Solutions and the SAP transaction DBACOCKPIT offer similar, in some areas partially
overlapping functions.
* Query Options File QAGQINI: A varisty of database options can be configured through @ query options
file named QAQGINI. Depending on the location of the file and the configuration of your SAP systems,
the configured parameters in this file can take effect system-wide, per SAP system or for selected SQL
statements within an SAP system. See SAP Note 20325 for more information about the general usage
of the query options fle. Specific options to configure for certain purposes are documented in separate
SAP Notes that deal with selected use cases.
+ Db2 Symmetric Multiprocessing (SMP) allows the SQL optimizer to split up a single query into multiple
threads that are executed in parallel. This may spead up the procassing of a query on a large table, but at
the same time uses more processing resources, $0 it should only be used when enough resources are
available. To use Db2 Symmetric Multiprocessing, option 26 of the operating system must be installed.
SAP Note 1879983 explains how to configure the use of SMP in an SAP landscape, for example through
‘a concitional statement hint for a specific CDS view.
+ Encoded Vector Indexes (EVs) offer an altemative to the common binary radix tree indexes and are a
variation on bitmap indexing. They provide benefits to JOIN operations, specifically in star or snowflake
schemas as they are used in business warehouse queries. They may also show significant improvements
when only a few columns of a very large table are queried and single-column EVIs exist over all
requested columns. In this case, the SQL optimizer can retrieve all the required data for the output from
the EVIs without the need to access the table itself. This access method is called EVI Only Access
(EOA), and itis available by default as of IBM i 7.2. More information about using EVIs with SAP on IBM
Db? for i can be found in SAP Note 2588130,
+ Preloading Database Objects into a Main Storage Pool: In general, the storage management
functionality of the IBM i operating system and Licensed Internal Code are automatically taking care of
assigning main storage to SAP systems and database operations. By default, all SAP systems within a
logical partition of a server share @ common main storage pool. However, there are cases when you want
to separate workloads and assign specific main storage pools to certain SAP systems (see SAP Note
49204),
18It may improve the performance of CDS views which access large tables, if you can use EVI Only Access
(EOA) and preload the EVIs into @ separate main storage poo! prior to the first execution of the
statement. The neceseary configuration steps are explained in SAP Note 2586130,
The following table concludes all SAP Notes mentioned above.
Any | 820325 | IBM i: Use of QAQQINI with SAP
218Mi7.2 | 1879983 | IBM i: Support for symmetric multiprocessing (SMP)
Any | 2588130 | IBM i: Using Encoded Vector Indexes with SAP
Any 49201 | IBM i: Main memory settings for SAP
DB Limits
‘After view expansion into a single statement, the number all table references must not be larger than 225,
(see SAP Note 2422860). If the same table is referenced more than once in a view, each reference of the
table counts towards that limit, The SAP-enforced limit of 225 table references in a view is smaller than the
database limit of 255 on IBM Db? for i.
SAP Notes & Patches for CDS
SAP Note 2075068 provides a list of all SAP notes relevant to successfully run CDS on IBM i, The list
comprises kernel and ABAP patches to fix known bugs as well as to activate new database performance
features. For convenience, you can run the health check functionality of report RSDB4CDSTOOLS telling you
what exactly is missing in a system.
For advanced tuning, it might be beneficial to install and activate the new DBA Cockpit.
2075088 IBM i: Overview of CDS on DB? for !BM i
2033326 all__| 18: Enhancements in the DBA Cockpit for the SAP Database Performance Collector
2142186 IBM i: Performance: Fast replenishment planning/rapid replenishment planning
2422860 CDS View Complexity
SAP Life-Cycle Management
When renaming the database, the schema information in certain CDS object types may not be updated
correctly, thus causing SQL errors at runtime when using these CDS views. In such a case, CDS views need
to be created again through selected ABAP programs. See SAP Note 2368628 for a description of the ABAP.
programs to execute and the cases where manual recreation is needed.
I you created EViIs to help the performance of CDS views, the EVIs will not be transported within your
system landscape. To achieve the same, good performance on all your systems, you must create the EVIs.
manually in your test or production system after transporting the other changes.
19Tuning Measures
IBMiACS 3 SQL
Performance Center >
Plan Usage Summary >
Current Plan Cache Size
Threshold
Maximum Plan Cache Size
Compare to “Current Pian Gache Size’. If possible,
selact “Change Configuration’ and set fo "AUTO"
which will koap the hit ratio at 90%.
Performance > Advised
Indexes
DBA Cockpit > ‘Select most expensive SQL statements for analysis.
Performance > SQL Expensive SQL statements Use function Explain to look at access plan and advised
Setemens indexes fora para stomon
DEA Cooks >
‘Access plan fora paricularSaL | Enter SOL statement for analysis, thn check and
Digrostcs > EXPLAIN etement arya expensive noses.
Index advices that the Check Number of rows (table size), runtime of most
284 cock > Indexaices athe SOL, | nave quer and nut Last anid bole
Performance 2 Soe |plimizerfound'o be vst | estng an advied indor. Test performance
Indexes Advised ices cannot be meppe afterwards. Not all indexes advised are necessarily
Spectic SQLstatomente. | atervarss. Nota nd
Summary of alindex avis for [Check tal si, oa run ine and average result st
084 Cocket > A'SOL staimens inte plan | sie to erty wef! insexes, Cpl al statement fo
cache, grouped by table.
Advices can be mapped to
specific SQL statements,
the selected table and check if multiple index advisories
‘can be combined into a singlo index, so that the numbor
of indexes in the database dos not grow too much.
DBA Cockpit
Diagnostics > DB
Catalog Browser
View definition / Object
dependencies / #able
references
Understand and simplify CDS view definitions and
object interdependencies of complex CDS views.
Identity large tables as potential candidates for EVls.
For more information on how to use the DBA Cockpit, search for “CCMS: IBM DB2 for i" at
http://help.sap.com. You can limit your search to the product "SAP NetWeaver" at the requested release
level. For example, with SAP NetWeaver 7.5, you will be directed to https://tinyurl.com/SAP-NW750-CCMS-
Db?
In case of problems or questions, you may always open an incident using component BC-DB-DB4.
20IBM Db2 for Linux, Unix and Windows
DB Levels
Supported Db2 Vorsions and Fix Pack Levels
Db2 10.5 for LUW | 1851853 _| Using Db2 10.6 with SAP applications
Db2 11.1 for LUW | 2303763 _| Using Db2 11.1 with SAP applications
Itis highly recommended to run with Db2 11.1 and the latest Fix Pack to benefit from Db2 optimizations
specific to CDS.
DB Settings
Db2 10.5 for LUW| 1851832 | Db2 10.5 Standard Parameter Settings
Db2 11.1 for LuW | 2303771 | Db2 11.1 Standard Parameter Settings
Any. 2047006 | Use of Db2 SMP Parallaism (INTRA_PARALLEL=YES)
Use the DBA Cockpit to verify the correctness of the database and database manager configuration (DBA
Cockpit > Configuration > Parameter Check)
DB Limits
All Db2 LUW limits are listed at https/tinyurl, comvIBM-DB2-LUW-11-1-Limits,
SAP Notes & Patches for CDS
asanara |2740 [pated in Jansory 2100 cover D62 1.tmtip4)
se1e502 [2740 | sa optimizer Proes
s6geg0 [2740 | Use of DB2 Optimization Guidelines
150037 [2740 [Database tints in Open SOL
2508486 [2740 [peormance problems wth SELECT .. LIMIT 7 queries
2465138 Replace function HEXTORAW with VARCHAR_BIT_FORMAT
2511300 perfomance of view wih hextbin000000000000000000000000000000007
zai6018 LEFT OUTER TO ONE join n CDS viewsSAP Life-Cycle Management
1365982 Current “db6_update_db/db6_updato_cliont” script
2485138 Replace function HEXTORAW with VARCHAR_BIT_FORMAT
2308337 DIC | CDS error during activation of CDS views with parameters ina SUM ZDO scenario
2237803 SUM __ | ABAP Upgrade with ZD0: Wrong DB Schema for CDS Objects
Tuning Measures
Ensure you are running on the latast Fixpack of Db2 as the product is constantly enhanced with additional
features to optimize the execution of CDS workloads. Standard Db2 LUW tuning approaches are valid for
CDS workloads as well. Ensure that the memory areas (e.g. Bufferpools and Sortheap) for Db2 are equipped
with enough memory and CPU resources ate available to support the parallel execution of queries. Also,
ensure up-to-date database statistics along with the SAP-recommended setting of the database manager
and the database configuration.
You can use the SAP DBA Cockpit to validate the configuration and to identity system bottlenecks, i.
* DBA Cockpit > Performance > SQL Cache
+ DBA Cockpit > Performance > Buffer Poo!
+ DBA Cockpit > Performance > Sorts
The following link connects to the DBA documentation, including a table with basic recommendations related
to the performance: httos:/tinyurl,com/SAP-on-IBM-Db2-LUW-Performance
‘The key factors for good CDS performance are the following
+ Parallelism
Best performance for CDS queries is achieved when executing a query with parallelism enabled and the
optimal execution plan selected by the Db2 LUW optimizer.
You can verify the parallel execution of a query by using the explain functionality of the DBA Cockpit
DBA Cockpit > Diagnostics > EXPLAIN
Please read through the following SAP Community document as an introduction for Explain functionality
within the DBA Cockpit: httos:/wikl.scn.sap.comvwiki/displav/ABAP/Explain+Pian
ReGESEILAR Ope Level = 5
elie = Intra-partition parallel
(QuezyDegree Orig = AY
QueryDegree Plan = 26
)SeLecr StATEVET(IERESAEEAICORET=UUNSEROSESERSGI cos cot cose 8/o_coet
SURETORE 2.coocteca 1.7482t008 ¢consEeoe
SORRY <.oic4Esoe s.7000RH05 «.ceerE+08
Figure 7: Db2 LUW Explain within the DBA Cockpit
Ensure that intra-partition parallelism is enabled with a meaningful number for QueryDegree. In addition,
check the plan for the "TQ" (Table Queue) operator. This operator should be as high as possible in the
plan as this is a good indicator for parallel execution as all operators above the TO will be executed
22«without leveraging intra partition parallelism. Refer to Figure 7 which shows an Explain from the DBA
Cockpit where the TO operator sits at top of the access plan.
There are some operators that force the plan to be serialized like “Jump Scan" access to an index, so an
additional index or a changed definition of a custom index can help. There are more operators that may
force serialization. If you face a performance issue with a query and @ low TQ operator, you may open an
incident using component BC-DB-DB6.
+ Access Plan
Beside the use of parallelism, the optimal access plan is the second important functionality to ensure
good CDS Query Performance.
Check the access plan for expensive access to certain objects. Expensive means either a high number of
timerons or many records processed within a certain lag of the plan. A good approach is to identify the
critical path within the plan and identify the objects or operators that are causing a high number of
timerons or are processing many rows. Often there is a table scan involved, and then adcitional indexes
may help to improve query performance.
Figure 8: Db2 LUW Access Plan Graph trom IBM Data Server Manager
Figure 8 shows the location of the TQ Operator as well as the information about a table scan together
with a hint that a recommendation for this plan object is found. A similar functionality is available in the
DBA Cockpit (DBA Cockpit > Diagnose > Index Advisor). Please, do not blindly apply the
recommendations. Instead, verify the results first along with potential side effects — e.g. space
consumption and insert overhead of additional indexes. Before applying such changes, you should also
open an incident using component BC-DB-DB6.
+ Statistics
‘The reason for non-optimal access plans could be missing statistics for the objects accessed in the plan.
Please ensure that the Db2 runstats uli is running in automatic mode, which can be checked with DBA
Cockpit > Configuration > Database, parameter AUTO_RUNSTATS. For a single table, you can also check
23date and time of the last runstats with DBA Cockpit > Space > Single Table Analysis. From there, you
can also refresh the statistics choosing "RUNSTATS in the background”
+ Cardinality
‘As the CDS queries might be complex constructs with sometimes dozens of tables joined, the cardinality
estimate of join results may be non-optimal and lead to wrong access plans. To verify such a mismatch in
the estimated and actual data used for the access plan, you can use the Db2 utlty "db2caem". This ulility
delivers a formatted EXPLAIN output, including section actuals (statistics for different operators in the
access plan) and details like CPU time for the statement execution.
For details about this utlity, refer to https:/tinyurl, com/IBM-DB2-LUW-11-1-db2eaem within the IBM
Knowledge Center.
+ Complexity
‘As CDS queries can become complex, itis sometimes useful to identify the objects involved and their
relationship or hierarchy. This may allow to isolate a problematic part of the query and eliminate many
objects form the access plan, which helps to analyze the issue. You may use the SQL statement depicted
in Figure 10 to retrieve an object hierarchy starting trom a given root object.
DEPENDENT OBOTYPE FUNCTYEE
2ES_CACCTRLDRSRC
28S_IACCTELDRADD
28S_ZACCTELDR
BUTi00
2FS_TBUPADATA
‘ADRE
POOL
BUTO0O
‘TSTMP_CURRENT_UTCTIMESTAMP
v
v
v
T
v -
tT
r
T
F
Figure 9: Db? LUW output of SQL listed in Figure 10
24wrt
sysdopendenctes ( dechona, dnamo, dtype, bechoma, bnano, btype ) as
(select TASSCHEMA, TABNANE, DTYPE, BSCHEMA, BNANE, BTYPE
‘From SYSCAT. TABDEP
unten 317
Select ROUTINESCHENA, SPECIFICNAME, 'F", BSCHEMA, ENAME, BTYPE
rom SYSCAT, ROUTINEDEP:
union 317
solect VARSCHENA, VARNAME, ‘v', BSCHEMA, BNANE, BTYPE
from SYSCAT. VARTABLEDEP )
depsearch ( dschema
dnane,
type.
scheme
type,
12 28 bschena,
‘8 bran
as btype,
21
cast( “TOP! as varchar (4096) AS treepath
FRON_syscependenc
WHERE Unano = °ZFS_CACCTHLORSRC' -- edit object (e.g. view namo) here
‘and dschena = 'SAPHUK* 2+ edit schens here
‘and dtype = 'V" Ii adit object type here (veview, Feroutine)
UNTON ALL
SELECT DEP.dschema,
DEP. name,
DEP. dtype,
DEP bschena,
DEP. bnane,
DEP. btype,
CTE Tevel + 1 AS evel
treepath || "->' || DEP.bnone as treepath
FROM eyedopendencice DEP, depsearch CTE
HERE CTE. brane = DEP cname. AND
CTE.bschema = DEP.dschoma AND
CTE btype = DEP-dtype AND
CTE Tevel < 100)
seLecT
substr (space(Teve1*2) | |bname, 1,58) as dependent,
type as objtype.
case
WHEN btype = "F" THEN (SELECT functiontype FROM syscat.routines
WHERE specitienane A. bschema)
ELSE NULL
END as functype,
case
WHEN btype = "F’ THEN (SELECT CASE WHEN Tanguage = ‘SOL THEN valid ELSE NULL END
FROM syscat routines
HERE speci ticnane = A.bnane AND routineschena = A.eschena)
WHEN btype = "V' THEN (SELECT valid from syscat.views
WHERE viouname = A.bnane AND viewschena = A.bechema)
ELSE NULL
END as valid
case
WHEN btype = 'T' THEN (SELECT card FROM syscat tables
WHERE tabnane = A.bnane AND tabschena = A. bechewa)
ELSE NULL
END as card
FROM depsearch A
ORDER BY treepath
e
Figure 10: Db2 LUW SQL statement to retrieve an object hierarchy
25Alternatively, you may again use IBM Data Server Manager, as this also shows the dependencies of
objects in the database. It does not provide a complete hierarchy of objects, but you can easily navigate
from object to object by drilling down either to depended objects or to parent objects that are referencing
the current object.
Cd Database Exslocer View-Z2FS ACCTHLDRADD x | View-ZFS_JACCTHLOR %
[ae] [ee] | [econ 50 [8s] | Reasane
oats
Propeties Columns Tiggers Dependencies Prieges
Circe ~ COSMUK ZFS |ACCTHLOR
~ Dependencies
Monitor = Tables
(cosMUK BUTI00
rey = Views
(COSMUK 2FS_JBUPADATA
~ References
eer) —
(COSMUKZFS_ACCTHLDRADD
(COSMUKZFS_ACCTHLORTST
(COSMUKZFS_PACCTHLORCUR
erry
ry
Figure 11: Db2 LUW dependencies and references for an object in the IAM Data Server ar
26IBM Db2 for 2/0S
DB Levels
Db2 11 foros |81737 | PUT evel 1804
Db2 12 for 2108 |81737__| PUT level 1711 plus APARs PIG0780 & Pie9564
nla 183311 _ | Automated PTF Check
Itis highly recommended to run with Db2 12 to leverage performance enhancements and avoid limitations
(see "DB Limits" below). Use report RSDB2FIX to check that all recommended product temporary fixes
(PTFs) are applied (SAP Note 183311).
DB Settings
Db2 11 for 2/08, Installation Parameter Settings for DB2 11
Db2 12 for 2105 | 2239553 | installation Parameter Settings for DB2 12
DB Limits
Be aware of the following limits in Db2 11 for 2/08 (https:/tinyurl comv/IBN-DB2-20S-11-1-Limits). In Db2 12
for 2/OS (https’/tinyurl,com/IBM-DB2-20S-12-1-Limits) those limits are beyond CDS requirements,
Maximum table references in one query | 225
Number of elements in an IN ist 750
SAP Notes & Patches for CDS
zaeoree |» 740 IBM DB2 Analytics Accelerator support with Convergent Invoicing
2432065 | 750 Enable support for DB2 12 LEFT OUTER TO ONE
2403112 [2740 CATMAINT SCHEMA SWITCH and VIEW/UDF hierarchies
2270401 |>740 SAP Optimizer profiles for DB2
2aese7a |» 740 Issue with dependent abjects during move nametabs
2313326 |» 740 COS div) SALGODE ~419
zaais1 [750 CDS SAP functions LEFT and RIGHT fallto spit surrogates
2142646 [> 740 Rapid replenishment performance
SAP Life-Cycle Management
2403112 | _Systemclone | CATMAINT SCHEMA SWITCH and VIEWIUDF hierarchiesTuning Measures
DBA Cockeit > Jobs > DBA planning
calendar
To ensure that adequate Db2 catalog
statistics are available for a certain
CDS query, run the query at least
‘once so that the Db2 12 quary engine
‘automatically generates a Runstais,
profile for the table
In the Panning Calendar of the DBA
Cockpit, schedule Update stats for
recommended objects
DBA Cockpit > Statement Cache
statistics
VO wait time
High number of Getpagas
Increase the size of the Db2 buffer
oo! to minimize HO wait times
CChack if Getpages are cue to
aggragation or due to an inefficient
access path
DBA Cockeit > Performance >
Storage > Workdiles
DBA Cockpit > Performance >
Subsystem Activity > RID list
processing
Overflow into physical tablespace or
workile not created because of
storage condition
ROS limit exceeded
Increase the size of the buffer pool
sed for workiles,
Increase ZPARM MAXRBLK
sufficiently to minimize “RDS limit
exceeded” this may require more
memory for the 2/08 LPAR
More information can be found in Section “Monitoring and Tuning of SAP CDS Queries” of the Db2 DBA
guide (hitps:/help sap.com/viewerldb2_administration_quide).Microsoft SQL Server
DB Levels
SOL Server 2014 1986701 _| Sotting up Microsoft SQL Server 2014
SOL Server 2016 | 2201080 _| Setting up Microsoft SQL Server 2016
‘SOL Server 2017 | 2484674 | Setting up Microsoft SQL Server 2017
Itis highly recommended to use a current version of Microsoft SQL Server plus the latest Cumulative
Upgrade (see httosu/technet microsoft.com/en-usllibraryf{803383.a80%)
DB Settings
‘SOL Server 2014| 1986775 _| Configuration Parameters for SQL Server 2014
‘SQL Server 2016 | 2312935 | Configuration Parameters for SQL Server 2016
SQL Server 2017 | 2484657 _| Configuration Paramaters for Microsoft SQL Server 2017,
DB Limits
Microsoft SOL Server restricts the number of nested views and functions to 32. You can use the SQL
Dependency Analyzer in ABAP in Eclipse to display the SQL Dependency Tree (open Data Definition in AIE
> Open With > Dependency Analyzer) to get an overview about the current nesting level of the CDS view.
A\list of all SQL Server database limits can be found here:
httos://does. microsoft, com/en-us/sal/sql-server/maximum-capacity-specifications-for-sal-server
SAP Notes & Patches for CDS
404584 | SAP_BASIS 2 740 _| Activation of CDS view fails on MSS.
2510415 |SAP_APPL618 [CDS Views cannot be created due to database limitation (function nesting level)
2125387 |SAP_APPL617___| Activation of CDS view aborts on MSS
2480994 | SAP_BASIS 740/750 | RS_CDS_COMPARE_DDIC_DB dump REGEX TOO_COMPLEX
Retcode 612: SQL-error "208-Invalid ebjact name
“kgy.TSTMP_CURRENT_UTCTIMESTAMP™
RUN_RUTCNVFUNCCRE_BI
"CURRENCY_CONVERSION
2398548 | SAP_BASIS 750
I: Unknown message with "DROP"
2279757 | SAP_BASIS 740
2423050 | DBSL > 721 CDS objects are not needed for DECON remote connections to SQL Server
2087418 | DBSL 742 ABAP runtime DBSQL_SQL_ERROR message: Missing end comment mark
SAP Life-Cycle Management
Use SAP Software Provisioning Manager (SWPM) for system copies.
28Tuning Measures
Standard SQL Server tuning measures apply. In case of a persistent performance
sue, you may also open
an incident using component BC-DB-NSS.
30Oracle Database
DB Levels
Apply the latest available SAP Bundle Patch (SBP):
Oracie 12.1 | 1888485 | Database: Patches for 12.1.0.2
Oracle 12.2 | 2507228 | Database: Patches for 12.2.0.1 (12.2)
Oracle 18¢ | 2660044 | Patches for 18c: Database
Oracle 19¢ In preparation
DB Settings
Oracle 12.1 | 1898485 | Database Parameter for 12.1.0.2,
Oracle 122 | 2470718 | Oracle Database Parameter 12.2/ 186
Oracle 18¢ | 2470718 | Oracle Database Parameter 12.2/ 186
Oracle 19¢ In preparation
DB Limits
Usage of CDS Views with parameters can cause a performance issue related to a pushdown of predicates,
with all Oracle Versions earlier than 19.5. A detailed description of the problem is described below. As of
Oracle Version 12.5 this DB Limit does not exist anymore as long as the SQL statement text of the CDS.
Views with parameters does not exceed the length of 32K. For details and necessary prerequisites see SAP
Note 2801989.
Performance Problems with CDS Views with parameters for Oracle Versions earlier than 19.
Usage of CDS Views with parameters can cause a performance issue as a pushdown of predicates is not
done by Oracle's execution engine. Therefore, itis recommended not to use CDS Views with parameters in
scenarios where a pushdown of predicates is required for performance reasons. This can include filter
conditions and join conditions as well Its planned to fix this issue in one of the upcoming Oracle database
versions.
The following simple example describes the problem:
First, a table tst1 with fields 1 (number(19)) and #2 (varchar2(12)) is created with one million rows. 2
rows contain in field f2 the value ‘BBB’ whereas the remaining 999998 contain the value ‘AAR’. In addition,
an index 1_tstt on field 12 is created.
31create table tett (1 nunber(10) defoult @ not mull, #2 verehar2(12) default °° not mult);
begin
for i in 1 .. 499999 toop
Sngert into tatt values (1, “AAA")
fend Toop;
fend:
’
insert into tst1 vatues (580080, "BBB");
begin
For i in 500091 .. 999999 Toop
Yngert inte tsti values (1, AAA")
fend Toop:
end;
’
ingort into tett values (100
comet:
create index 4 tett on tett (12);
Now, a table function (= CDS View with parameters) and a common database view (= CDS View without
parameters) are created, Both contain a simple select statement on table tst1 and a where condition on
field 11.
Table function:
select * from tet! where #1
funetion)
Common database View:
select * from tett where #1 <= 50004
fune.p_f2 (tfunc.p #2 is an input paraneter of the table
Table Function (= CDS View with Parameters)
create type tfune 1 as object (#1 mumbor(10), #2 varchar2(12) )
create type tfune_t as table of tfune_)
create function tfune (p_#2 nunbe)
return tfune_t pipelined ts
begin
for 4 in (
select * from tett where #1
) Toop pipe row tfune_1(
an,
ttune.p #2
vey)
‘end 100;
fend tfune
Common Database View (= CDS View)
create view tview as
select * from tsti where ft
506
In the next step, a select statement on the table function and on the database view is executed. Both
statements contain a where condition on field #2 (f2 = "BBB", The table function has the value 586888 as,
input parameter. Therefore, both select statements are logically the same and retrieve only one row.
32select * trom tablo(tfunc( p_f2 => 589088 ))
B88:
where #2
Ft F2
500800 BBE.
Elapsed: 09:00:00.45
select * from tv
where (2 = "BBB
Ft Fe
500080 88
Elapsed: 00:00:
02
As a result, we can see that the runtime of the select statement using the table function is by a factor of
more than 20 slower. The reason is, in case of the common database view, that the where condition 12 =
BBB’ can be evaluated as a filter at the lowest level in the procassing stack. In contradiction to the case
where the CDS View with parameters is used, first, all 500000 rows are retrieved by the table function and
then the filter 12 = "BBB" is applied, afterwards.
33| 1d | operation | Name | Rows | Bytes | Cost (SCPU)| Time |
1 @ | SELECT STATEMENT 1 i 1 1 30 (100)) 1
Iv 1 | COLLECTION ITERATOR PICKLER FETCH] TFUNC | 82] 164 | 29 (8)| 00:00:61 |
Query Block Name / Object Alias (identified by operation ia)
41. SELSFSBB74E1 / KOKBFSOZSELS2
Predicate Information (identified by operation td)
Td_| Operation | Name | Rows | Bytes | Cost (%CPU)| Time
f
| @ | SELECT STATEMENT | 1 fl 1
Iv 1 | TABLE ACCESS FULL| TST! | 42114 | 863K] 449. (2)| 98:00:01
| Object Alias (identified by operation id)
4 SELS1 / TSTIeSELS1
Predicate Information (identified by operation td)
1 ~ fitter ("FI"<=:B1)
SAP Notes & Patches for CDS.
2452203 |740-751__| Error in CDS views with parameters for CAST from DEC to CHAR
Error during activation of CDS views with parameters due to naming conflicts in input
parameters
2310324 |740-750 _[ Error in function SAP_SUBSTRING
Error during activation of CDS views with parameters due to naming conflicts in the
database
2347301 | 740-781
2104388 |740
SAP Life-Cycle Management
No recommendations specific to Oracle.
Tuning Measures
Standard Oracle tuning measures apply. For details refer to:
© https:/tinyurl. com/SAP-NW750-DB-Guide-Oracle
© https:/tinyurl.com/Oracle-Monitors-and-Tools
34SAP Adaptive Server Enterprise (SAP ASE)
DB Levels
Itis highly recommended to use latest available SAP ASE version and patch level
16.0 P03 | 2505861 | Release information for SAP ASE 16.0 SPO3 with SAP Business Suite
DB Settings
ASE 16.0 | 1581695 | Configuration Guide for SAP ASE 16.0,
DB Limits
Refer to https://tinvurl.con/SAP-ASE-16-Specifications.
SAP Notes & Patches for CDS
24osa19 |» 740 c-based functions for eds-viaws
2173015 |2 740 CDS Views with paramater
2e70511 |2 740 Note collection for CDS with ASE
SAP Life-Cycle Management
2587717 DB Update saphostctrl- temporary objects when recreating CDS objects
2438875 SUM Errors when calling function DATE_1S_VALID
2500400 SUM Etvor COMPUTE_BCD_OVERFLOW during SUM Upgrade
2340482 SUM CDS Views using sap_upper/ sap_lowor
When running a database update by utlizing SAP-Host-Agent, make sure to use at least PL39.
When executing maintenance activities with Software Update Manager (SUM), make sure to use at least
SUM 1.0 SP22 PL12 or SUM 2.0 SP3 PL7.
Tuning Measures
Ensure that regular statistics updates for the complete system are scheduled within the DBA cockpit. More
dotails are available at:
https /itinyurl.com/DB-Administration-SAP-on-ASE
* httos:/itinyurl.com/DBA-Guide-SAP-on-ASE,
35SAP HANA DB
DB Levels
It is recommended to use latest available SAP HANA DB version and patch level
10 2021789 _| SAP HANA 1.0 Revision and Maintenance Strategy
20 2378962 _| SAP HANA 2.0 Revision and Maintenance Strategy
DB Settings
x Configuration paramotors for the SAP HANA system
DB Limits
Ayoid cyclic OUTER joins,
SAP Notes & Patches for CDS
1973033 |740 [ABAP Dictionary/CDS enhancements and corrections for SAP HANA database
234244 |750 ABAP Dictionary/DB consistency check reparts errors for CDS views:
2azs642 [751 Activation error for CDS view with FLTP_TO_DEC conversion
ziszo11_|740 CDS: Incorrect resulting set for view with SUBSTRING function
SAP Life-Cycle Management
For the SAP Software Update Manager, all prerequisites (version, patches, etc.) are checked during the
initial phases of the tool
Tuning Measures
To learn about SAP HANA DB and its administration in general refer to the following links
+ https:/ihelp.sap.comiviewor/pSAP_ HANA PLATFORM
. hel jewerlp! PI
(covers monitoring, managing, and analyzing performance within the SAP HANA Cockpit)
Particularly helpful in case of database specific problems are the following sources of information.
+ httos:/wiki.waf.sap.corp/wikildisplay/SuiteCDS/CDS+View+Performance+-+Good+to+Know
+ SAP HANA Troubleshooting and Performance Analysis Guide available at:
htips:/tinyurl com/HANA-Performance-Analysis-2-04
36SAP MaxDB
DB Patch Levels
Itis highly recommended to use latest available MaxDB version and patch level.
The minimum requirement is MaxDB 7.9.09.05, refer to the following SAP Release Note for details:
Feature List for SAP MaxDB 7.9
DB Settings
Set the MaxDB database parameters per SAP recommendations (also see SAP Note 1346964),
CommandBufferSize | 524288
DB Limits
Number of join tables 254
Number of parameters in a SQL statement | 10000
SAP Notes & Patches for CDS
2600424 |> 740 Important information and note collection for CDS with SAP MaxDB
ABAP CDS: SELECT on CDS view returns sqlcode -8008 and slerrtext ‘Data types must
2137908 [2740 be compatie
2137955 [2740 ABAP COS: CDS view with CASE statement without ELSE branch
2ieo1s7 [2740 ABAP CDS: CDS view with RIGHTILEFT function
2302503 |750 MaxDB: Error during generation of CDS views
za1o4e1 |= 740 ABAP CDS: CDS view with UNION select dumps with error code -407
2345104 |750~751 _| CDS view activation terminates with SQL error -3008 "Invalid keyword or missing delimiter"
2423642 |751 Activation error for CDS view with FLTP_TO_DEC conversion
2432048 |2 740 Error -4023 for creation of CDS view
SAP Life-Cycle Management
No recommendations specific to MaxDB.
Tuning Measures
Ensure that regular statistics updates for the complete system are scheduled within the DBA cockpit.
7TRAINING
The table below lists SAP training options related to ABAP CDS.
8C430_| ABAP Dictionary
$4430 _ | Building Views in Core Data Services ABAP
38APPENDIX
List of changes
July 2019
+ Updated the following database spectic sections:
— “IBM Db? fori" ~"DB Levels" (page 18)
Microsoft SOL Server’ — “DB Levels" / "DB Settings” (pages 29%)
~ "Oracle Database” — “DB Levels" / "DB Settings” (page 3111)
+ Updated section “Documentation Links” (page 8)
+ Reviewed and updated web links
January 2019
* Changed title from “ABAP Core Data Services on anyDB | Best Practice Guid
Services | SAP Business Suite ~ Best Practice Guide
* Added information related to SAP HANA DB throughout the document
* Added section “SAP HANA DB" (page 36) to chapter "Database Specifics”
* Updated section “Development Rules and Governance” (page 14)
* Added section "Performance Safeguarding” (page 1)
* Added SOL Server 2017 to section “Microsoft SQL Server” (page 29)
+ Updated SAP ASE specific patch levels of SUM and SAP-Host-Agent in section “SAP Life-Cycle
Management’ (page 35)
© Added section “Training” (page 38)
+ Reviewed and updated web links
to"ABAP Core Data
February 2018
First version of this guide.
Figures
Figure 1: Principles of ABAP Core Data Services 5
Figure 2: ABAP in Eclipse development framework 8
Figure 3: Components and activities when exposing CDS views to OData «9
Figure 4: CDS consumption by SAP Fior - architecture overview 10
Figure 5: Analysis for Microsoft Office with Excel and PowerPoint 10.
Figure 6: SAP Convergent Invoicing 11
Figure 7: Db2 LUW Explain within the DBA Cockpit 22
Figure 8: Db2 LUW Access Plan Graph from IBM Data Server Manager 23
Figure 9: Db2 LUW output of SQL listed in Figure 10 24
Figure 10: Db2 LUW SQL statement to retrieve an object hierarchy 25
Figure 11: Db2 LUW dependencies and references for an object in the IBM Data Server Manager 26.
38References
SAP Roadmaps
httos:/iwww. sap com/products/roadmaps.htm!
SAP Community
https://a0.sap.com/community htm!
SAP Products
https:/iwww_ sap com/products htm!
ABAP Development
https://waww.sap,com/community/topies/abap. html
SAP Fiori / SAP User Experience
https:/iwiww.sap.com/products/fior tml
40