CDS Views
No Comments

Best Practices for SAP CDS Views

Close up view on violin's play.

Use the Virtual Data Model for CDS Views

Use Type Annotations for Basic Views, Composite Views, and Consumption Views

Use the respective type annotation for basic, composite, and consumption views in the DDL file:

  • @VDM.viewType: #BASIC
  • @VDM.viewType: #COMPOSITE
  • @VDM.viewType: #CONSUMPTION
@VDM.viewType: #BASIC
define view I_BusinessPartner ... { 
	key BusinessPartner, 
	...
}

SAP uses the annotation @VDM.viewType for internal structuring and interpretation of the CDS views. For example, in the Fiori View Browser in S/4 HANA systems.

Use Naming Conventions for Basic Views, Composite Views, Consumption Views, and Remote API Views

The SQL View Name can have maximal 16 characters, and the CDS View name can have maximal 30 characters.

Use Z, Y, or the registered namespace of the company as the first character in every name to signal that it is a custom file and not a SAP file.

And when referring to SAP business entities reuse the field names defined by SAP. When creating own field names or when extending SAP delivered views then use as a prefix a YY or ZZ.

SQL View Name

<PREFIX><DESCRIPTION> – for example, ZIBPADDR.

The <PREFIX> consists of

  1. Y, Z or the registered namespace of the company,
  2. I (interface view), C (consumption view), or A (remote API view)

The <DESCRIPTION> is

  1. all written together,
  2. all in upper case letters.

CDS View Name

<PREFIX><Description> – for example, ZI_BPNameAddress.

The <PREFIX> consists of

  1. Y, Z or the registered namespace of the company,
  2. I (interface views), C (consumption views), or A (remote API views),
  3. an underscore _.

The <Description> is

  1. all written together,
  2. in CamelCase.

Most Recent Articles

Poll

Will SAPUI5 replace the SAP CRM Web UI soon?

Loading ... Loading ...

More Similar Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu