This blog post explains how to enable CDS data models for C0 developer extensibility, how to find extensible models, and how to extend such a model by means of developer extensibility.
It answers the following questions:
Ready? Let’s go.
Developer Extensibility is the new extensibility option on ABAP Platform, available since ABAP Platform 2021. It enables cloud-ready and upgrade-stable custom ABAP code in cloud projects, combining the benefits of custom ABAP code with the required restrictions for cloud readiness. It delivers flexibility beyond key user extensibility patterns, with debugging, rich developer IDE, custom applications, and packaged solutions.
One use case for developer extensibility is the ABAP RESTful Application Programming Model (RAP). It allows you to extend your RAP application from the database to the service definition directly in ADT with custom ABAP code.
This blog post explains developer extensibility on CDS level.
For further details on developer extensibility, visit SAP Extensibility Explorer for SAP S/4HANA Cloud (ondemand.com)
A release contract is a classification of a repository object as released API and it ensures a certain stability of the repository object in question. There are currently four different release contracts at SAP:
The C0 release contract ensures stability of a repository object at dedicated extension points. The C0 contract is a prerequisite for developer extensibility in cloud development.
The following CDS entities can be released under the C0 stability contract: CDS view entities, CDS projection views, CDS abstract entities, and CDS custom entities.
As a prerequisite for C0 release, your entity requires certain extensibility annotations.
The following annotations are mandatory:
The following annotations are optional:
Example
The following CDS view entity DEMO_CDS_PRODUCTTP_E is based on the DDIC database table DEMO_PRODUCT and it fulfills all requirements for C0 release:
@EndUserText.label: 'Demo for C0 released API'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
@AbapCatalog.extensibility: {
extensible: true,
elementSuffix: 'DMO',
allowNewDatasources: false,
dataSources: ['Persistence'],
quota: {
maximumFields: 250,
maximumBytes: 2500
}
}
define view entity DEMO_CDS_PRODUCTTP_E
as select from demo_product as Persistence
{
key product_id
}
This example is taken from the ABAP Keyword Documentation and it is part of the package SABAPDEMOS.
When your CDS entity meets all requirements, go to Properties > API State and add the C0 release contract for Use in Cloud Development.
Step 1:
Step 2:
Step 3:
The tool immediately checks whether your entity fulfills all requirements and release is only possible if all tests are passed.
Where can you find C0-released APIs shipped by SAP for developer extensibility? How do you find out whether you can extend a certain application?
1) ABAP Keyword Documentation
A list of all released APIs delivered by SAP Basis can be found in topic Released APIs.
2) ADT folder
You can configure your ADT to display a folder with C0 released APIs as follows:
Result: Your ADT project now has a folder which lists C0 released APIs for the selected project:
3) Check the API state of an object
You find the API state of an individual repository object in the Properties tab in section called API State.
As a prerequisite, the view you want to extend must be released under the C0 stability contract.
There are a few rules to obey if you want to extend a C0 released API, most importantly naming conventions:
Example
The following extension extends the CDS view entity DEMO_CDS_PRODUCTTP_E displayed above. It fulfills all requirements for consuming a C0 released API from the restricted ABAP language version ABAP for Cloud Development:
extend view entity DEMO_CDS_PRODUCTTP_E with
association [0..1] to DEMO_CDS_UNIT as _zz_ToUnitDMO
on $projection.zz_unit_dmo = _zz_ToUnitDMO.UnitOfMeasure
{
@Semantics.quantity.unitOfMeasure: 'zz_unit_dmo'
Persistence.zz_quantity_dmo,
Persistence.zz_unit_dmo,
_zz_ToUnitDMO
}
This example is taken from the ABAP Keyword Documentation and it is part of the package SABAPDEMOS.
Questions are welcome.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
19 | |
14 | |
11 | |
10 | |
9 | |
8 | |
7 | |
7 | |
7 | |
5 |