Skip to Content
Technical Articles
Author's profile photo Xiao-fei Song

Importing @sap/cds common.cds to your CAP project using the CDS Graphical Modeler

SAP CDS ships a common.cds file that includes various aspects that can be used in your CDS model. In this blog post, we’ll demonstrate how to import the @sap/cds common.cds into your CDS model and how to use the aspects to your CDS entities in your CAP project.

When you open your CDS file using the CDS Graphical Modeler, you will see below screen:

Now you can click “+” button and select “Import common.cds” menu item:

Then select a few aspects in the dialog:

Click “Select” button to close the dialog. When you see the CDS file, you will be able to find the import statement for CDS common:

namespace my.bookshop;

using {
    cuid ,
    managed ,
} from '@sap/cds/common';

entity Books
    key ID : Integer;
    title : String;
    stock : Integer;

Now create an “Authors” entity using the CDS Graphical Modeler:

Select the Authors entity and click “Include Aspect” toolbar item:

and you will be able to see the include aspect dialog:

Select a few of them in the dialog and close the dialog:

Then you will see the inherited properties from the aspects from the selected aspects in CDS common for Authors entity:

As a summary, we demonstrate how to import @sap/cds common.cds into the CDS model and include the selected aspects to the CDS entity in the CDS Graphical Modeler, and the CDS Graphical Modeler provides an easy way of including those CAP built-in aspects and inherit the properties for CDS entities.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.