0% found this document useful (0 votes)
967 views9 pages

002 ABAP CDS - ABAP Annotations For Translatable Texts

This document discusses ABAP annotations for translatable texts in CDS views. It explains that EndUserText annotations define translatable semantic texts for a CDS object at either the view or element level. Translations are done using transaction SE63 and added to transport requests using transaction SLXT. The global class CL_DD_DDL_ANNOTATION_SERVICE can be used to dynamically access annotation texts based on language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
967 views9 pages

002 ABAP CDS - ABAP Annotations For Translatable Texts

This document discusses ABAP annotations for translatable texts in CDS views. It explains that EndUserText annotations define translatable semantic texts for a CDS object at either the view or element level. Translations are done using transaction SE63 and added to transport requests using transaction SLXT. The global class CL_DD_DDL_ANNOTATION_SERVICE can be used to dynamically access annotation texts based on language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1

ABAP CDS on HANA

ABAP Annotations for translatable texts in


CDS Views
ABAP Annotations play a very important role as they define technical and semantic
attributes of a CDS object. They are usually evaluated for every CDS object when
activated by the ABAP runtime environment.
In this article I have tried to explain in detail about the ABAP annotations for translatable
texts in CDS views.
ABAP annotations starting with EndUserText are used to define translatable semantic
texts for a CDS object.
• EndUserText.label
EndUserText.label is available as view annotation (i.e. available at CDS entity level) or
as element annotation (i.e. available for individual element). The maximum length is
limited to 60 characters.

• EndUserText.quickinfo
EndUserText.quickinfo is only available as element annotation (i.e. available for
individual element). The value is stored as string and can have arbitrary length.

View Annotation

1
2
ABAP CDS on HANA

Element Annotation

Translation of Annotations
The values of text annotations are stored in special tables that have language key and
that are translatable. The value specified in the source code should consist of text in the
original language of the CDS source code and is translated into the required languages.
Translation of CDS views is done as usual in the translatable editor (T-Code SE63). A
new object type CDS view has been added to group User Interface Texts.
Please follow the below steps to translate the texts defined in the given DDL Source:
1) DDL Source whose texts need to be translated –

2) Execute T-Code SE63

2
3
ABAP CDS on HANA

3) Choose ‘Short Texts’ from the toolbar

4) On the next dialog window, expand node User Interface Texts.


5) Choose and double click on sub-element DDLS CDS Views.

6) On the next dialog window, enter the name of DDL Source, the source and target
language.

3
4
ABAP CDS on HANA

7) Click on Edit.

8) Enter the texts in target language specified and click on SAVE button to save the
values.

4
5
ABAP CDS on HANA

Adding CDS Texts translations to Transport request


Once we have saved the translations, we would require transporting them through
various SAP systems. Unfortunately, translations are not added to TR automatically and
need to be added manually.
T-Code SLXT is used for this purpose. This T-Code will execute ABAP program
RS_LXE_RECORD_TORDER or RS_LXE_LOG_EXPORT depending on the version of
SAP you are using.
Execute T-Code SLXT.
Enter the selection as follows and execute –

5
6
ABAP CDS on HANA

On execution, Texts would be saved in the created TR –

6
7
ABAP CDS on HANA

Dynamic Access to Annotation Texts


The methods of global class CL_DD_DDL_ANNOTATION_SERVICE read the texts as
specified by an input parameter for the language.
If no language is passed to the input parameter, the logon language is used as the
default.

7
8
ABAP CDS on HANA
Example –
Case 1) Source Language (English in this case)

Output –

Case 2) Target Language (German in this case)

8
9
ABAP CDS on HANA

Output –

Note – If no text is found for the language, the secondary language in AS ABAP is
used.

You may find the same information in our website article - https://sapyard.com/cds-part-14-abap-
annotations-for-translatable-texts-in-cds-views/

You might also like