SAP S/4 HANA > CDSVIEWS

Semantic Annotations in CDS Views

Hello,Welcome to my blog.In this post i will explain you about Semantic Annotations in CDS Views.

Semantic Annotations:

For data processing, analytics, and data consumption, the core engines need to correctly interpret the columns used in the projections list. Semantics annotations inform the clients about the data type.

Semantic Annotations

Semantic annotations are used to inform the client as to which of the elements contain a phone number, a part of a name or address, or something relating to a calendar event, and so on. They must not be bound, for example, to a dedicated consumption channel. They need to be available for consumption through OData, (S)QL, and so on.

Semantic annotations complement the concept of semantic data types, while semantic data types always introduce specific behavior in the provider/core infrastructure (through dedicated operations or conversion functions). Semantic annotations allow the standardizing of semantics that only have an impact on the consumption side (such as telephone number, mail address, city, and so on).

Semantic Annotations –> text and url

The following text and URL semantic annotations are available:

@Semantics.text: ‘<Value>’

Description: This annotation identifies a human-readable text that is not necessarily language-dependent.

Possible values: true or false

With the annotation @Semantics.text the field is identified as a human readable text field. This field does not need to be language-dependent.

@Semantics.url: ‘<Value>’

Description: This annotation field contains a URL, and its mime type is contained in the referenced second field.

Possible values: URL

Semantic Annotations :currencyCode and amount.currencyCode

The following currencyCode and amount.currencyCode semantic annotations are available:

@Semantics.currencyCode: ‘<Value>’

Description: This annotation tags a field containing a currency code.

Possible values: true or false

@Semantics.amount.currencyCode: ‘<VALUE>’

Description: This annotation contains a monetary amount, and the corresponding currency code is contained in the referenced field.

Possible values: [ELEMENT, PARAMETER]

With the annotation Semantics.currencyCode, the field is tagged as containing a currency code. This can be either an ISO code or an SAP currency code (data type CUKY).

The annotation @Semantics.amount.currencyCode identifies the field as containing a monetary amount, and the corresponding currency code is contained in the referenced field.

In my earlier posts i explained in detail about currency conversion in CDS. You can check same here.

Semantic Annotations –> unitOfMeasure and quantity.unitOfMeasure

The following unitOfMeasure and quantity.unitOfMeasure semantic annotations are available:

@Semantics.unitOfMeasure: ‘<Value>’

Description: This annotation tags a field as containing a unit of measure.

Possible values: true or false

@Semantics.quantity.unitOfMeasure: ‘<Value>’

Description: The value of the annotated field specifies a unit of measure related to a measured quantity.

Possible values: [ELEMENT, PARAMETER]

With the annotation @Semantics.unitOfMeasure, the field is tagged as containing a unit of measure.

Note:
There seems to be currently no internationally recognized standard list for units of measure available.

The annotation @Semantics.quantity.unitOfMeasure identifies the field as containing a unit of measure related to a measured quantity .

In my earlier posts i explained in detail about Unit Of Measure conversion in CDS. You can check same here.

Related Articles