In the following we discuss how master data texts can be maintained for CDS dimensions (used in CDS queries). See also
- CDS Embedded Reporting on ABAP CDS views
- BW InfoObjects in the context of CDS Views
- CDS views: HowTo use in BW contexts
- In the Dimension CDS view (with @ObjectModel.dataCategory: #DIMENSION), use @Semantics.text: true to define the text field. In the same view, use @ObjectModel.text.element to specify the default text field (displayed in query) for a key field.
- A Text CDS view is defined with @ObjectModel.dataCategory: #TEXT and can be associated with the corresponding dimension.
- Language and time dependent texts are only possible when a Text CDS view (defined with @ObjectModel.dataCategory: #TEXT) is associated with a Dimension view. In the simplified 'inline text model' in a Dimension view only language and time independent text is possible.
- Use @AnalyticsDetails.query.display to specify whether key and/or text is displayed in a CDS query.
- The default text can be controlled by annotation @ObjectModel.text.element in a Dimension view. A list of fields can be specified in this annotation. The first one is the default text field.
- Annotation @Semantics.text: true can be used to define multiple text fields. The one with the longest field length is generated as the long text, the second long one (if any) is the medium text, the shortest one (if any) is the short text. Analytic Engine only supports short text with length <= 20, medium text with length > 21 and <= 40, long text with length >40 (in ABAP up to 1300 characters are possible, see Long, Medium and Short Text for details). If the text length is longer than a limit, the text is truncated.
- Further details to a text view (defined with @ObjectModel.dataCategory: #TEXT):
- Use @Semantics.language: true to define language key. The text CDS view has to provide only one text record for all individual master data values for a given language (and a given date), so it should contain unique values. This means that there must not be multiple text records for the same master data value.
- Use @Semantics.businessDate.from and @Semantics.businessDate.to define time dependent texts. One of them should be a key field of the text table (usually the @Semantics.businessDate.to field). The time dependent text CDS view needs to contain a unique value for any given time spot. That is, there are no multiple text records for the same master data value for any given time.
- In the Dimension CDS view (with @ObjectModel.dataCategory: #DIMENSION), use @ObjectModel.text.association to associate the text to the master data.
- When there are three text fields (annotation @Semantics.text: true), the longest field is generated as the long text, the second one is generated as the medium text, the shortest one is the short text.
- When there are two text fields, the longer one is generated as the long text, the shorter one is the medium text.
- When there is one text field, it is generated as the long text.
- By default, the shortest text is displayed in query result.
If the rules of points 7a/7b are broken, the following may be observed:
- A query build on CDS model may get unexpected key figure multiplication when drill down some attribute text. The reason is similar to the effects explained in Ambiguous Join. Unique text is a fundamental pre-requisite for CDS modeling.
- In the query result output, one of the text records is shown as the text, which may not be the one as expected.
- Very simple inline text in a CDS view: using @Semantics.text: true and @ObjectModel.text.element
- Language Dependent / Time Dependent Text in CDS
- Long, Medium and Short Text
- Cube with association to DIMENSION and TEXT
- Text for Attributes
- Meta Data Texts