It is good practice to separate the annotations with CDS view logic. A metadata extension separate annotation from business logic. To implement metadata extension
Metadata extensions only allow annotation of JSON style.
CDS code
@AbapCatalog.sqlViewName: 'ZAMARMNFE1'
@Metadata.allowExtensions: true
@EndUserText.label: 'ZAMARMN_FE1'
@OData.publish: true
define view ZAMARMN_FE1
as select from SEPM_I_SalesOrder
{
key SalesOrder as SalesOrderID,
_Customer.BusinessPartner as CustomerID,
_Customer.CompanyName as CustomerName,
GrossAmountInTransacCurrency as GrossAmount
}
CDS Metadata Extension
@Metadata:{
layer:#CUSTOMER
}
@UI.headerInfo: {
typeName: 'Sales Order',
typeNamePlural: 'Sales Orders',
title: {
value: 'SalesOrderID'
}
}
annotate view ZAMARMN_FE1
with
{
@UI.lineItem: [{position: 10 }]
SalesOrderID,
@UI.lineItem: [{position: 20 }]
CustomerID,
@UI.lineItem: [{position: 30 }]
CustomerName,
@UI.lineItem: [{position: 40 }]
GrossAmount
}
If there are different metadata extensions for the same CDS entity, priority is determined by the following criteria: CDS Variant and Layer of metadata extension. CDS variant are not currently released for general use.
Layer of metadata extension: these are the enumeration symbols of layers, in descending order of priority.