In case you don’t know about ABAP CDS let me short introduce the basic facts. CDS allows building database views with many features of SQL-92 that are available for HANA and anyDB. You can use it for

  • data models for operational analytics
  • fast queries – identification of business objects or building packages for parallelization
  • fast data access for OData services where joins are only used if necessary
  • you can use is to “redefine” DDIC information in SELECTs which can help you to overcome restrictions in many frameworks like BRFplus
  • it will be one major cornerstone for building next generation application apps in NW 7.5 and S/4HANA which was/will be explained in this year’s SAP TechEd.

You can read more about it in the following blogs:

This is only a short blog entry but reflects experiences with ABAP CDS in releases NW 7.40 SP8 and 11 we had in the development of two complex CDS models. Those hints may sound easy but if I had know it earlier many things would have been easier.

Get the latest ADT tools

You need ABAP in Eclipse to create and edit DDL Sources. Please don’t work with older versions of ADT tools. Until summer they allowed some dangerous manipulations that will bring you in big trouble.

Learn SQL-92 and apply SQL best practices

CDS is about view building. Improve your SQL skills before starting with CDS. Otherwise you will most likely create severe errors. Without SQL knowledge it is possible that you will get bad runtime results. But if you are a skelled SQL developer you will get amazing results.

Start slowly

With CDS you can build complex data models. But complexity is no value in itself – simplicity rules. So start slowly and explore all features. The complexity will arise soon when you are building view on view which is the usual programming model.

Learn about restrictions

Sometimes restrictions are hidden in the documentation: http://help.sap.com/abapdocu_740/en/abenselect_cds_para_abexa.htm und the ABAP Keyword Documentation. So please read it carefully. By the way: I am don’t like the way SAP communicates the restrictions but this is the topic of another blog entry.

Use the ABAP package concept

CDS models use to get complex and complicated within short time.  I recommend to implement CDS views with different purposes (operational reporting, OData..) in different ABAP packages. One reason for it is to control reuse. I made the experience that most ABAP developers don’t understand the concept of reuse and apply it whenever if it’s possible and not when it is necessary.

Study OSS Notes

CDS is a new technology and there are problems like the one here: http://service.sap.com/sap/support/notes/2023690. So I recommend to study the OSS, from time to time, f.e. following note: http://service.sap.com/sap/support/notes/2238561.

In case of activation errors the following notes are helpful:

Be careful before changing data models

We made the experience that changing components of transparent tables can lead to activation erros when there are CDS views with parameters defined on top of it. In this case you have to perform all necessary changes manually. Because of those errors we decided to test changes in CDS models in a sandbox first.

Look at transport protocols

As I mentioned before CDS is a new technology and we had some surprises with the transport behavior. So look at the transport protocols.

Visit this years’s SAP TechEd

CDS is a cornerstone of new business applications – so I recommend to visit ABAP lectures like “DEV106 – The ABAP Programming Model in SAP S/4HANA” (see https://scn.sap.com/community/abap/hana/blog/2015/09/08/abap-at-sap-teched-2015  for example).

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Christiaan Edward Swanepoel

    Hi Tobias,

    thanks for this, it will be very useful for ABAP CDS developers.

    Although I wasn’t surprised that you should mention “Use the ABAP package concept” (I sort of expected it ;-)), I am just wondering how you mean this. Are you “simply” suggesting to structure your development objects using packages (a great value in itself), or do you really mean that you should use the package concept to encapsulate your CDS objects (package interfaces, etc.)? The latter is somewhat tricky with CDS views.

    It would also be interesting to know how widespread the use of the package concept is in the community.

    Thanks

    Chris

    (0) 
    1. Tobias Trapp Post author

      Hi Chris,

      Christiaan Edward Swanepoel wrote:

      Are you “simply” suggesting to structure your development objects using packages (a great value in itself), or do you really mean that you should use the package concept to encapsulate your CDS objects (package interfaces, etc.)? The latter is somewhat tricky with CDS views.

      From my experiences many ABAP projects start this way: they create a CDS model for a specifc purpose (OData comsumption or operational reporting). IMHO it is useful to seperate the models and not to mix them up. Otherwise you need to spend much time in modeling and especially governance of models.

      And yes, if I encourage reuse I recommend to use package interfaces.

      Christiaan Edward Swanepoel wrote:

      It would also be interesting to know how widespread the use of the package concept is in the community.

      I think more and more people adopt it 🙂 But there is a problem: I think name ranges for development classes can’t be used for packages: Are Name Range Definitions using V_TRESN State-of-the-Art? Maybe you could help and tell how SAP is using this.

      Cheers,

      Tobias

      (0) 
  2. Attila Laczko

    Hi Tobias,

    thanks for sharing this.

    Regarding the transport protocols, it’s a valuable hint.

    So I could build some extra knowledge with respect on how the CDS truly works on DB:

    – because in my CDS Entity not all key fields were defined, the activation process in target system generates a warning, that all fields as key fields will be evaluated. (I know that the KEY for a field has a semantic nature)

    My questions here:

    – will be the behaviour other as expected when calling in SELECT or should I ignore the warning? 😕

    – it is recommended, as best practice, to define all the key fields of a referenced table in the CDS?

    – one CDS was without Buffering defined. The activation process says, because of Currency fields the Buffering cannot be used and the transport will be restricted. As explanation for the messages, comes the statement:

    “A numeric type was used for a key field. A table of this sort cannot be buffered.

    When buffering, the table records for numeric values cannot be stored in plain text.

    Therefore, no entries are found when buffered numerical values are compared in the WHERE condition, although the table can contain entries satisfying the compare criterion.”

    My question here: should I expect unstable results from the SELECT consuming the CDS Entity? 😕 (I will keep an eye on them anyway 😐 )

    All these messages are related to the DB Views.

    thanks in advance!

    Cheers,

    Attila

    (0) 

Leave a Reply