SAP CDS ANNOTATION ARRAY ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_CDS , Annotation Array
This example shows how an annotation array is evaluated in a piece of DDL source code.

ABAP_SOURCE_CODE
DEMO CL_DEMO_CDS_ANNOTATION_ARRAY

ABAP_DESCRIPTION
The class reads the element annotations of the following CDS view entity:
DDLS DEMO_CDS_ANNOTATION_ARRAY
An annotation array Consumption.filter.hierarchyBinding with two elements is assigned to the view field ID and each of the elements is structured using three subannotations type, value, and variableSequence.
The annotation array is a subannotation of a framework-specific annotation delivered by SAP and defined as follows in its annotation definition: annotation Consumption
{

...

filter
{

...

hierarchyBinding : array of
{
 type: String(12) enum { ELEMENT;
PARAMETER;
CONSTANT;
USER_INPUT;
SYSTEM_FIELD; };
value : String(512);
variableSequence : Integer;
};
};
};
In the case of elements of the annotation array, square brackets are specified in the tabular list of the framework-specific annotations. These brackets are used as placeholders for the $ signs used in the internal metadata repository, which enclose the serial index of an array element.