Child pages
  • Language Dependent / Time Dependent Text in CDS
Skip to end of metadata
Go to start of metadata
  1. Text CDS view is defined with @ObjectModel.dataCategory: #TEXT
  2. The text CDS view should provide only one text for a master data value for a given language and a given date.
  3. Use @Semantics.language: true to define language key
  4. Use @Semantics.businessDate.from and @Semantics.businessDate.to define time dependent text. One of them should be a key field of the text table (usually the @Semantics.businessDate.to field)
  5. In the Dimension CDS view (with @ObjectModel.dataCategory: #DIMENSION), use @ObjectModel.text.association to associate the text to the master data.
  6. Use @AnalyticsDetails.query.display to specify key or text display in a CDS query.

 Associate a #Dimension CDS view with a #TEXT CDS view will provide corresponding text to a characteristic. The text can be language dependent and/or  time dependent.

First, in the text table there should be a language key field and/or valid date fields. (Remark: this is just a local example which never meant to transport, thus it uses some generated /BIC/* data elements, please don't use generated data elements in general.)

The table contains some language dependent and time dependent texts.

In this table, you need to guarantee: For each language and any given date, there is only one text entry available for a characteristic value.

Define the text CDS view as below:

In the #Dimension CDS view, associate the master data with this text CDS view by using @ObjectModel.text.association annotation.

With annotation @Semantics.language and @Semantics.BusinessDate, system will automatically handle the logon language and key date information. Therefore, language and date fields must not appear in the association. The Analytic Engine will read text with the where-clause: datefrom <= keydate and dateto >= keydate and langu = logon language.

See below:

In transaction RSRTS_ODP_DIS, we can see characteristic 2CZGL_COUNTRY2V has text in metadata now:

In a CDS query, system will display text with keydate (current date if it is not explicitly specified) and logon language. With annotation @Semantics.businessDate.at (available as of Note 2537093), the query can define a key date parameter as below:

When run the query 2CZGLTXTQ1, a query key date can be input in variable screen: 

Execute it with key date as '01.01.2017', system reads text with SQL statement as below:

So country 'AAA' gets a text valid for date 01.01.2017 according to the text table. Other countries only display key as no text available on that date:

Change the variable key date to  '01.01.2018', a different text on that date is displayed:

If the user logon the system with language='DE', the query gets text for date '01.01.2017' as below:

 

SAP Online Documentation:

Semantics Annotations

SAP Notes:

  • 2537093 CDS based BW Query: enable the use of CDS Parameter as Query Key Date
  • 2617181 ABAP CDS: #DIMENSION or #TEXT view with key date parameter

 

 

 

  • No labels