An annotation adds context for people and tools

The field package_count is technically readable, but a consumer benefits from the human-facing label Packages. CDS annotations add metadata that can influence documentation and supported consumers.

Label the entity and an element

@EndUserText.label: 'Dispatch package counts'
define view entity ZI_PACKAGE_COUNT
  as select from zdispatch_order
{
  key dispatch_order as DispatchOrder,
      @EndUserText.label: 'Packages'
      package_count  as PackageCount
}

Annotations are placed in the DDL source and attach to the next artifact or element according to the annotation’s rules. SAP provides many annotations; use the official annotation documentation rather than guessing names.

Semantics beyond labels

Amounts and quantities may need currency/unit references; dates, language, and authorization also have semantics. Correct metadata allows consumers to interpret fields consistently. Do not add a unit or currency annotation unless the referenced field really supplies that unit/currency.

Practice

Add the two labels above. No output statement is requested because this is CDS DDL, not ABAP executable code. The structural checker cannot activate or validate annotation semantics in an ABAP system.

Sources

Version note: Annotation availability and consumer behavior vary by release and application framework.

Developer practice · ABAP

Practice: label a quantity and a key

Add a user-facing entity label and element label in annotations before the matching CDS definitions.

Complete the task using the syntax and structure described above. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.

0 required structures detected · 0 checks