Programming

ABAP CDS Q&A with Authors Renzo Colle, Ralf Dentzer, and Jan Hrastnik

Authors Renzo Colle, Ralf Dentzer, and Jan Hrastnik recently took part in the SAP PRESS Book Club webinar series, where they answered reader questions about CDS and ABAP over the course of an hour. There were so many questions submitted that we couldn't to get to them all.

 

The authors were able to answer the remainder of the questions in this blog post. Read on to learn more about CDS with ABAP!

 

Q: We are planning on using the CDS view Actual Plan Line Item Semantic Tag in margin analysis. Does SAP still plan to support this strategically until 2040?

A: Please address this question to your regular SAP contact.

 

Q: In which scenarios are ABAP-managed database procedures used?

A: In the context of ABAP CDS, AMDPs are used for implementing CDS table functions. CDS table functions in turn can be used for leveraging advanced SAP HANA features such as predictive analytics.

 

Q: What is different in this edition of your book compared to the pervious one?

A: The major difference is the switch from the ABAP Programming Model for SAP Fiori to the ABAP RESTful application programming model (RAP) that replaces BOPF in the transactional applications with the native RAP infrastructure. Other than that, the book was extended with many new features that were added in SAP S/4HANA 2023 compared to SAP S/4HANA 2021.

 

Q: Does your book cover new SAP S/4HANA 2023 CDS as well as the old CDS like SAP S/4HANA 2019?

A: The book focuses on the latest CDS modeling. Specifics of old DDIC-view-based CDS views (aka V1 views) are not described in detail. Still, some examples of DDIC-view-based CDS views are included.

 

Q: Does the book have examples of RAP as well?

A: Yes, there is a working example application that is built step by step throughout the chapters of the book.

 

Q: Is there any repository with all standard CDS created from SAP based on the SAP S/4HANA data model that we can search in our daily activities?

A: The book describes two ways for browsing CDS views delivered by SAP: released views are published on the SAP Business Accelerator Hub at https://api.sap.com/ and all views are visible in the View Browser App of an SAP S/4HANA Cloud (public edition) trial. In ABAP Development Tools (ADT), you can find the ABAP repository tree for released objects.

 

Q: How can I analyze performance bottlenecks of CDS views?

A: Performance is a complex topic. In the book you find some general hints for improving the performance of your views, including links to further resources that provide you with additional information about analyzing the performance of your CDS views.

 

Q: Working with CDS technology takes some time for an ABAP developer to get used to it. How long do you think it would take to reach a medium proficiency level for an ABAP developer?

A: Depends on the envisioned scope: In a few days you should be able to define simple CDS views. However, it may take months to become an expert at building complex analytics, search, and transactional applications.

 

Q: Can you explain the difference please between CDS views and calculation (SAP HANA) views, and when to use each?

A: CDS views are tightly integrated into the ABAP development and transport environment, while SAP HANA calculation views must be developed natively on SAP HANA and specially prepared for transport with ABAP. As a regular ABAP developer you will only use CDS views.

 

Q: What is the best way to publish V4 service bindings? Does it need to be done via SAP Gateway Service Administration or is it also possible from Eclipse?

A: OData V4 services are exclusively defined via service binding and registered as such on activation. Publishing in ABAP Development Tools (ADT, Eclipse) is possible but only for local publishing and local testing. Productive publishing is to be done via transaction /IWFND/V4_ADMIN.

 

Q: What are the differences between PRIVATE, INTERFACE, CUBE, COMPOSITE, and CONSUMPTION CDS views?

A: The overall VDM view model is layered: BASIC views form the foundation for all other CDS view models. COMPOSITE views combine and transform data of potentially multiple BASIC views. Both BASIC and COMPOSITE views act as reuse INTERFACE views. CONSUMPTION views are tailored for supporting specific use cases. They are used to construct services such as OData services from INTERFACE views.

 

PRIVATE views are helper views which are used to compose the overall functionality of non-private views.

 

Function-wise CDS views may serve different purposes. In the context of analytics, DIMENSIONs are often defined as BASIC views, CUBEs are typically defined as COMPOSITE views and QUERIES are defined as CONSUMPTION views.

 

Q: Sometimes technology evolution makes recently developed artifacts outdated within four to five years. How do you look at this problem? Clean core has been mentioned but that will not always be possible. How can we handle this issue as we may not have downward compatibility right now?

A: The ABAP programming model targets ABAP Cloud. Therein, features are released if these are considered to be mature. SAP delivered objects should only be used if these are released explicitly for the corresponding consumption scenario. Released objects are subject to a well-defined lifecycle contract aiming to avoid respectively reduce disruptions for consumers.

Regarding clean core we recommend you check out this post.

 

Q: How do you provide security for CDS views?

A: The book explains how you can protect your CDS views against unauthorized data access for common use cases.

 

Q: Can CDS views only be created from Eclipse?

A: CDS views can be created from ABAP Development Tools (ADT, Eclipse) and from dedicated SAP Fiori key user apps.

 

Q: What's the name of the report to convert old CDS into new CDS entity views?

A: The report is called RUTDDLSV2MIGRATION. Alternatively, you can migrate via ADT/Eclipse and chose function “Migrate to CDS View Entity…” in the context menu of a Data Definition. See also this post.

 

Q: Is there a sample ABAP RAP application somewhere we can look over?

A: Yes, besides the example in the book best check out the ABAP RESTful Application Programming Model (RAP) | SAP Community where you can find an SAP Fiori elements reference app as well as many downloadable examples as part of the ABAP Flight reference scenario.

 

Q: What does the error “To many associations cardinality n are not allowed here” mean? The error did not provide a good explanation about its reason. Is this error known to you and, if yes, can you explain why it exists, and what the best way to deal with it is?

A: This error might occur if you use path expressions in where conditions that are based on associations with a maximum target cardinality > 1. In such a case, it is not clear whether the condition needs to be met for all target records or whether a single matching target record would be sufficient. The handling of such errors depends on the actual functionality you want to implement. Sometimes one may apply a suitable filter or an additional on-condition or aggregate the data of the target view for reducing the maximum cardinality of the association to 1.

 

In the context of RAP certain associations might not be supported by the managed runtime depending on your release. In such a case you can implement the association on your own via syntax “unmanaged association.”

 

Q: What are the advantages of CDS views?

A: CDS leverages and integrates SAP HANA capabilities with the ABAP environment. CDS conveniently extends SQL with pre-defined associations, a path notation, and syntax elements for analytical and transactional applications. CDS annotations enrich CDS views with technical and semantical information.

 

CDS views delivered by SAP create a business-oriented façade on top of database tables with standardized terminology, associations to related entities, and semantic annotations.

 

Q: In SAP S/4HANA, do we make these CDS views in SAP BTP or can we make inside core SAP S/4HANA and use them in SAP BTP?

A: Typically, the CDS views are defined in the system where the data is persisted in.

 

Q: Can I make a CDS view that is equivalent to a database stored procedure that does a little more than a single SQL?

A: You can use SAP HANA SQLScript in a read-only AMDP function for implementing CDS table functions. These CDS table functions can be used as data sources for defining CDS views.

 

Learn Modern ABAP in Our Upcoming Rheinwerk Course!

Learn how to use AMDP, CDS, and OOP in your ABAP programming! This upcoming course in September is live on the web and will teach you all you need to know about these topics. Click on the banner below to learn more and order your ticket.

 

Modern ABAP Course

 

Recommendation

Core Data Services for ABAP
Core Data Services for ABAP

If you’re developing ABAP applications, you need CDS expertise. This book is your all-in-one guide, updated for SAP S/4HANA 2023! Start by learning to create and edit CDS views. Walk through CDS syntax and see how to define associations and annotations. Further refine your model by implementing access controls, service bindings, and table functions. Understand the CDS-based virtual data model, and then follow step-by-step instructions to model analytical and transactional applications. From modeling to testing to troubleshooting, this is the only book you need!

Learn More
Renzo Colle, Ralf Dentzer, and Jan Hrastnik
by Renzo Colle, Ralf Dentzer, and Jan Hrastnik

Renzo Colle is currently responsible for the end-to-end programming model of SAP S/4HANA in the central architecture group. Ralf Dentzer has been working for several years in the central architecture group of the SAP S/4HANA suite with a focus on the use of core data services in SAP S/4HANA. Jan Hrastnik is a member of the SAP S/4HANA cross architecture team, where he focuses on the virtual data model and the use of core data services in ABAP applications.

Comments