ABAP - Keyword Documentation →  ABAP - Rules for ABAP Cloud →  Contract Rules for ABAP Released APIs →  C0 Contract Rules →  C0 Contract Rules for DDIC Objects → 
Mail Feedback

Example: C0 Released DDIC Structure, Design and Consumption

This topic provides an example for the design of a C0 released DDIC structure. It also shows an example for an extension to this released API from the restricted ABAP language version ABAP for Cloud Development.

DDIC structure as a C0 released API

The following DDIC structure DEMO_RELEASED API defines all necessary extensibility annotations and can be released as a stable API under the C0 contract.

Note: This DDIC structure serves merely demonstration purposes. It meets all the requirements for C0 release. However, it is not released under the C0 contract because it is not intended to be used as an API.

@EndUserText.label : 'Used for demo of C0 Released API'
@AbapCatalog.enhancement.category : #EXTENSIBLE_ANY
@AbapCatalog.enhancement.fieldSuffix : 'EMO'
@AbapCatalog.enhancement.quotaMaximumFields : 250
@AbapCatalog.enhancement.quotaMaximumBytes : 2500
@AbapCatalog.enhancement.quotaShareCustomer : 50
@AbapCatalog.enhancement.quotaSharePartner : 50
define structure demo_released_api {
  product_title   : abap.char(30);
  @Semantics.amount.currencyCode : 'demo_released_api.currency'
  amount          : abap.curr(7,2);
  currency        : abap.cuky;
  @AbapCatalog.anonymizedWhenDelivered : true
  created_by      : char12 not null;
  created_on      : abap.dats not null;
  created_at      : abap.tims not null;
  @AbapCatalog.anonymizedWhenDelivered : true
  last_changed_by : char12 not null;
  last_changed_on : abap.dats not null;
  last_changed_at : abap.tims not null;
}

Extending a C0 released API

The following append structure DEMO_STRUCTURE_EXTEND extends the DDIC structure DEMO_RELEASED_API displayed above. It complies with the naming rules, using a namespace prefix and the mandatory field suffix EMO.

Note: The prefix ii is representative. It is meant as a reminder to use the correct namespace prefix. In customer systems, the namespace prefix yy or zz must be used.

@EndUserText.label : 'Demo of extension to C0 Released API'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
extend type demo_released_api with demo_structure_extend {
  @Semantics.quantity.unitOfMeasure : 'demo_structure_extend.ii_unit_emo
  ii_quantity_emo : abap.quan(15,3);
  ii_unit_emo     : abap.unit(3);
}

The class CL_DEMO_DDIC_RELEASED_API provides type information of the extended DDIC structure. It also includes the extension fields.