Show TOC

Language-independent Text Elements Locate this document in the navigation structure

Within the context of CDS views, the text elements establish the link between identifier elements (code values) of the view and its descriptive language-independent texts. For example, you can define a link between a company code and the (descriptive) company name, or between currency code and the currency name. These kinds of descriptive texts are language-independent.

Relevant Annotation

Annotation

Effect

@ObjectModel.text.element[]

Establishes the link between the annotated element (that defines an identifier element) and its descriptive language-independent texts

Note The usage of this annotation excludes the usage of @ObjectModel.text.association.

More on this: ObjectModel Annotations

Note SADL Runtime Behavior: In OData exposure scenarios, the first text element listed in the annotation array will be handled as a descriptive text of the annotated field.

Example

In the listing below, the CDS view I_Plant defines the fields PlantName and PlantDescription that both serve as language-independent descriptions for the view field Plant.

	...
	define view I_Plant as ...
	{
	  @ObjectModel.text.element: ['PlantName','PlantDescription'] 
	  key Plant,
	  PlantName,
	  PlantDescription,
	  ...
	}
	
Caution

Obsolete Use: You may be aware that the Consumption.labelElement annotation is used in the same context. This annotation also enables consumers to identify through which elements the descriptive texts for the identifier elements can be retrieved. In the example below, the label of currency is set through the CurrencyText field:

		@Consumption.labelElement: 'CurrencyText'  --Obsolete use! 
		currency_code as CurrencyCode,
		currency as CurrencyText	
					
However, we recommend using ObjectModel.text.element[] instead of the Consumption.labelElement annotation:
	@ObjectModel.text.element: ['CurrencyText']   --Recommended use!
	currency_code as CurrencyCode,
	currency as CurrencyText