Saturday, 29 June 2019

Modularizing CDS Annotations

You use CDS annotations to enrich your data model with metadata. In some cases, this can reduce readability and make it hard to maintain your data definitions. To improve this situation, metadata extensions have been introduced.

Metadata Extensions


With metadata extensions you can modularize the annotations within your data definitions and add customer-specific metadata to SAP entities modifying the data definition. It’s a transportable ABAP development object with its own Dictionary folder in the Project Explorer.

Using Refactoring Features and Templates


To improve the readability of your data definition you can extract annotations from the data definition into a separate metadata extension. Just select the relevant annotations in the CDS view with the mouse and choose “Source Code” > “Extract Metadata Extension” from the context menu.

SAP ABAP Certification, SAP ABAP Certifications, SAP ABAP Learning

The extraction wizard for creating a new metadata extension is opened.

SAP ABAP Certification, SAP ABAP Certifications, SAP ABAP Learning

Here the same logic is used as for the rest of the development objects.

Templates provide you a predefined set on code.

SAP ABAP Certification, SAP ABAP Certifications, SAP ABAP Learning

I am sure, you know what to do. After finishing, the selected annotations are removed from the CDS view and added to the new metadata extension.

But you don’t have to extract all annotations to make your code clearer. You can also show and hide all annotations for a quick check. To do this, right click in the ruler bar beside the editor.

SAP ABAP Certification, SAP ABAP Certifications, SAP ABAP Learning

From this menu, you can choose the relevant entry.

Finally, I want to highlight code folding. It allows you to collapse coherent parts of source code such as SQL clauses, CDS annotations, and comments. You can trigger it from the same menu as hiding comments/annotations.

SAP ABAP Certification, SAP ABAP Certifications, SAP ABAP Learning

If you choose “Collapse All”, the annotations are hidden:

SAP ABAP Certification, SAP ABAP Certifications, SAP ABAP Learning

The fact that the annotations are collapsed is highlighted by the sign at the beginning and the double dot indicator at the end of the row.

1 comment:

  1. yang di punya oleh masing-masing pemain. kalau tidak ada balak diantara pemain, karena itu di tetapkan dengan cara pemain yang memiliki bulatan paling tinggi yang di punya. dalam permainan domino qiu qiu ada 4 type point kartu yang paling tinggi atau kartu special
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme terpercaya
    hobiqq
    paito warna oregon
    syair hk
    datahk

    ReplyDelete