Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
horst_keller
Product and Topic Expert
Product and Topic Expert
28,252

ABAP CDS in TechEd Keynote

bjoern.goerke has shown ABAP CDS in his keynote for TechEd Barcelona, yes, ABAP!

Interestingly, he did not talk much about all the DDL language elements of ABAP CDS. In fact, he used quite a simple CDS view:

The select statement of the view wraps the access to database table zbg_marsdata. Some of the modeling capapbilities of CDS shine through with the association _MarsSite that joins Z_MarsRoverMissions with Z_MarsSites. But this was of marginal importance for the presentation.

What he did talk about were annotations!

The DDL source code consists mainly of annotations and not of SQL! What's that all about?

With annotations, you can semantically enrich your data model. And as you see, this is abundantly done above. Let's have a look behind the curtain.

What are Annotations?

From the compiler's point of view, annotations are simply something that can be written at given positions and have to follow a prescribed syntax. As shown in an example of the documentation, you can write something like

@v_annot4:{ annot0, annot1:'abc', annot2:123 }

into the DDL source of a CDS view. The source is syntactically correct and can be activated. Of course, such an annotation has no meaning as long as nobody evaluates it. During activation of a DDL source, its annotations are saved in system tables and there are system classes available to evaluate them.

Some annotations are evaluated directly during activation and by the ABAP runtime environment.

Annotations before ABAP 7.50

Before ABAP 7.50, only a handful annotations played a role. Those were the annotations that are evaluated during activation and by the ABAP runtime environment. We call those annotations ABAP annotations. They are documented as part of the ABAP CDS documentation, as e.g. the ABAP view annotations. An important example is @ClientDependent, that defines the client handling when Open SQL is used to access a CDS entity. Other examples are the EndUserText annotations that denote translatable texts.

Annotations with ABAP 7.50

The usage of annotations is not restricted to the ABAP Dictionary's own needs and the ABAP runtime environment (e.g.. Open SQL). As said above, you can enter for annotations what you want, as long as you stay within the syntax rules. Of course, there must be someone who evaluates it. And that's what software components of SAP do with ABAP 7.50! Software components of SAP such as ODATA, UI, and Analytics prescribe sets of annotations that can be used to achieve a defined behavior and the frameworks themselves provide frameworks that evaluate these framework specific annotations and act accordingly. With other words, it's not the ABAP runtime environment alone any more that evaluates DDL source codes! Accordingly the documentation of these annotations is not part of the ABAP CDS reference documentation (so don't send your error messages there ...) but delivered by the respective software components. There is a landing page where all SAP annotations are listed and where you find links to the detailed framework documentation.

As you see in the screen shot of Bjoern's session above, he uses lots of framework specific annotations as @Search... , @UI.... While the syntax coloring and code completion of ADT recognizes them, the ABAP runtime environment (e.g. Open SQL) does not care at all. You have to work with the respective frameworks in order to see the effects! Of course Bjoern did exactly that.

Here is an example for a documentation that describes what you have to do in order to expose a CDS View as OData Service:

Exposing CDS View as OData Service

Have fun!

Note

Please note that SAP currently does not recommend to create customer annotations, At the moment you should work with SAP annotations (ABAP annotations and framework specific annotations) only.

PS: Sorry for the blurred screen shots, but they are taken from the TechEd video.



7 Comments
Labels in this area