RAP Extensibility has been released with ABAP release 7.57 (OP). SAP-delivered RAP BOs can be extended by customers. Customers can add extension fields (field extensibility), behavior (behavior extensibility) and extension nodes (node extensibility) to RAP BOs by means of developer extensibility.
This blog post is about C0 developer extensibility for CDS behavior definitions (BDEFs). It explains how to enable a BDEF for C0 developer extensibility and how to extend a C0-released BDEF.
I have already published blog posts about C0 Developer Extensibility for ABAP Dictionary Objects | SAP Blogs and C0 Developer Extensibility for CDS Data Models | SAP Blogs.
Contents of the current blog post:
Developer extensibility is a new extensibility approach that allows ABAP developers to create upgrade-stable custom ABAP code in cloud and on-premise environments. It delivers flexibility beyond key user extensibility and can be done directly on the software stack using the ABAP Development Tools (ADT) via local released APIs.
RAP extensibility is one use case of developer extensibility. It allows extending a RAP business object - either by adding extension fields, extension behavior, or extension nodes.
RAP extensibility relies on the C0 release contract (extend). Development objects, such as DDIC objects, CDS views, or BDEFs, that are released under the C0 contract guarantee stability at dedicated extension points. Only C0 released APIs can be extended from ABAP for Cloud Development.
The most important prerequisite for C0 release is that the BDEF in question has been enabled for extensibility. That means it must define stable extensibility anchors. This is done by adding the syntax addition extensible at different positions in the CDS behavior definition. All possible extensibility anchors are highlighted in green in the following image:
If your BDEF is extensibility-enabled in this way, the most important part is done. There are some other rules that are checked during a C0 release, such as the following:
An exhaustive list of C0 prerequisites can be found in the ABAP Keyword Documentation under C0 Contract Rules for CDS Behavior Definitions.
The following CDS behavior definition name is based on the CDS view entity name and it fulfills all requirements for C0 release :
managed implementation in class bp_demo_rap_base_det_val unique;
strict(2);
extensible
{ with determinations on modify;
with determinations on save;
with validations on save; }
define behavior for DEMO_RAP_BASE_DET_VAL
persistent table DEMO_DBTAB_ROOT
lock master
authorization master ( instance )
extensible
{
create;
update;
delete;
field(readonly:update) key_field;
}
RAP BO interface:
interface;
extensible;
define behavior for DEMO_RAP_INT_DET_VAL alias RootInterface
{
use create;
use update;
use delete;
}
This example is taken from the ABAP Keyword Documentation and it is part of the package SABAPDEMOS.
BDEF extensions are allowed in accordance with the extensibility scope defined in the original BDEF, and they must comply with the naming rules. For example, a BDEF extension and all of its elements must use the same namespace prefix.
The following BDEF extension DEMO_RAP_EXT_DET_VAL extends the RAP BO displayed above.
extension using interface DEMO_RAP_INT_DET_VAL
implementation in class bp_demo_rap_ext_det_val unique;
extend behavior for RootInterface
{
determination setStatus on save { create; }
}
C0 developer extensibility for BDEFs has been available since ABAP release 7.57 (OP), ABAP release 7.89 (quarterly release).
ABAP Keyword Documentation
Development Guide for the ABAP RESTful Application Programming Model, section Extend.
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 |
---|---|
16 | |
11 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |