Show TOC

Component AnnotationsLocate this document in the navigation structure

Component annotations enable you to add metadata to a component.

In ABAP Development Tools (ADT), you can add the following annotations to a component:

Short Description

Syntax Form
@EndUserText.label: 'short_description'
Definition

The short text is used as an explanatory text for a component that is typed with a predefined dictionary type. For components that are defined with a user-defined dictionary type, the corresponding short text is taken.

Editor-Specific Information

These texts are always displayed in the original language. If you change any text, the text is saved in the original language as well.

If the logon language differs from the original language of the structure, a warning is displayed in the editor.

Currency Field

Syntax Form
@Semantics.amount.currencyCode : 'structure.field_containing_currency_key'
Definition

If a component is based on the abap.curr predefined type, it has to be linked with a currency code field based on the abap.cuky predefined type.

Example

The salary structure defines the unit component with the predefined data type abap.curr. Therefore the reference to the curreny_key component needs to be set. This is set through the given annotation.

DEFINE TYPE salary {
@Semantics.amount.currencyCode : 'salary.currency_key'
  amount       : abap.curr(10,2);
  currency_key : abap.cuky;
}

Unit Field

Syntax Form
@Semantics.quantity.unitOfMeasure: 'structure.field_containing_unit_key'
Definition

If a component is based on the abap.quan predefined data type, it has to be linked with a unit field based on the abap.unit predefined type.

Example

The order structure defines the item_quantity component with the abap.quan predefined data type. Therefore the reference to the item_unit component needs to be set. This is set through the given annotation.

DEFINE TYPE order{
  @Semantics.quantity.unitOfMeasure: 'order.item_unit'
  item_quantity : abap.quan(4);
  item_unit     : abap.unit(2);
...
}