The syntax of CDS will grow if complex annotations are needed. That may reduce the readability of CDS.
A metadata extension separates annotation from business logic.
Perform the following steps to implement a metadata extension:
- Add an annotation of @metadata.allExtensions:true to the CDS view.
- Create a Metadata extension and write annotations for the view and its fields.
- Use ";" to separate fields.
Note
Metadata extensions only allow annotation of JSON style.Some annotations relevant to the activation of CDS, like @odata.publish, @AbapCatalog.sqlViewName are not supported in a metadata extension.
Note
If there is more than one metadata extension annotation for the same CDS, refer to https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_meta_data_extension_eval.htm to know how to determine which metadata extension is used.