03-15-2019 9:39 AM
I have created a custom CDS view in my local package as follows:
@AbapCatalog.sqlViewName: 'ZMD_C_PUR_REQ3'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Consumption View Purchase Requisition'
@ObjectModel.semanticKey: 'banfn'
@ObjectModel.transactionalProcessingDelegated: true
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true
@ObjectModel.entityChangeStateId: 'last_change'
@OData.publish: true
define view ZMD_C_PUR_REQ_03 as select from ZMD_I_PURCHASE_REQUISTION {
key banfn,
status,
@Semantics.systemDateTime.lastChangedAt: true
last_change
}
After activating this CDS view and exposing the generated OData service in transaction /IWFND/MAINT_SERVICE, it does work as expected, even with optimistic locking for handling concurrent updates.
Moreover, my requirement is to add further business logic so that the payload of an update request is validated against a given rule set. That is, if the updated data violates the rules, the update request shall be rejected and the client should be notified (e.g., by an HTTP 500).
How can I accomplish this?
I could not find any generated classes like *DPC_EXT where I can enrich the business logic.
I also did create a validation on my BOPF business object that is registered for update. However, upon updating an entity via OData this validation gets not invoked.
03-15-2019 2:00 PM
DPC_EXT classes are only generated if you create an OData Service based on your CDS view using SEGW and the "Referenced Datasource Approach".
Validations are defined in BOPF as described here: