Skip to Content
Mar 03 at 09:00 AM

Unable to Update Additional Fields in Extended CDS view for Standard ODATA API.



We have to add 3 additional fields from EKPO table to the PO Item node in the SAP standard Purchase Order API (which is published in SAP API Hub). For this we need to extend the Standard CDS view A_PurchaseOrderItem.

First, we created a custom CDS view which fetches the 3 fields LEBRE (InvoiceIsServiceReceiptBased), KZABS (IsOrderAcknowledgementRequired) and LABNR (OrderAcknowledgementNumber) from EKPO table as below:

@AbapCatalog.sqlViewName: 'ZEKPO'

@AbapCatalog.compiler.compareFilter: true

@AbapCatalog.preserveKey: true

@AccessControl.authorizationCheck: #NOT_REQUIRED

@EndUserText.label: 'EKPO Table extra fields'



define view Z_EKPO

as select from ekpo


key ebeln as PurchaseOrder,

key ebelp as PurchaseOrderItem,

lebre as InvoiceIsServiceReceiptBased,

kzabs as IsOrderAcknowledgmentRequired,

labnr as OrderAcknowledgmentNumber


Then, we created the extended CDS view for A_PurchaseOrderItem and created an association from the Extended CDS view to the custom CDS view as shown below:

@AbapCatalog.sqlViewAppendName: 'ZPOITEM'

@EndUserText.label: 'API PurchaseOrderItem Extension'

@VDM.viewExtension: true

extend view A_PurchaseOrderItem with Z_A_PurchaseOrderItem

association [1..1] to Z_EKPO as _ekpo on $projection.purchaseorder = _ekpo.PurchaseOrder

and $projection.purchaseorderitem = _ekpo.PurchaseOrderItem






After doing this, we are able to see the additional fields in the PO Item node in the SAP standard Purchase Order API and we are getting the values of these 3 additional fields in both GetEntity and GetEntityList, along with other standard fields. But when we are trying to update the PO Item using PUT/PATCH only the standard fields are getting updated, not the Extended CDS view fields. How can we enable updation of the Extended view fields also in this case? Thanks.