2024 Feb 19 8:40 AM - edited 2024 Feb 20 6:35 AM
Hello SAP Gurus,
My query is exactly same as the below one,
But since there is no answer for this, am creating a post again.
We have added Standard PO Item field BEDNR to the CDS EntitySet responsible for Item details in /sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder
We are successfully able to use this newly added field for Data Fetch that is GET calls but during POST its not getting updated at the Table level.
@AbapCatalog.internal.setChange: 'FLDADD_NO_ASS_INFLUENCE'
@AbapCatalog.sqlViewAppendName: 'ZS_PO_API_EXT'
@EndUserText.label: 'Purchase Order API Extension'
extend view A_PurchaseOrderItem with Z_PO_API_EXT
{
R_PurchaseOrderItem.RequirementTracking
}
Helpful pointers much appreciated on understanding where we could be missing on this.
Thanks,
Sijin
Hello all,
We finally got it resolved, below is the solution:
The solution lies with Enhancing/Extending the Standard CDS 'E_PurchasingDocumentItem' with the fields which are not available as part of Standard API, and this will enable the Transactional capabilities for the fields added using this Extension CDS view.
@AbapCatalog.internal.setChange: 'FLDADD_NO_ASS_INFLUENCE'
@AbapCatalog.sqlViewAppendName: 'ZS_PO_BEDNR'
extend view E_PurchasingDocumentItem with Z_PO_BEDNR
{
Persistence.bednr as RequirementTracking
}
So, in the nutshell, considering this example case i.e. BO Root View 'A_PurchaseOrder' or we can say API '/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder', if we need to add Fields in the API just for GET (QUERY and READ) Operations at ITEM level then just Enhancing 'A_PurchaseOrderItem' with the needed fields will work.
But, on top of this if we need to add Transactional capabilities(remaining CUD operations i.e. CREATE, UPDATE and DELETE) as well on the newly added fields then we need to Enhance CDS View 'E_PurchasingDocumentItem' in a similar manner.
NOTE: This approach is only needed for missing Standard Fields in the API/CDS/BusinessObjects related Structures. For adding Custom Fields we should always resort to the Standard Fiori app meant for this purpose i.e. Custom Fields and Logic , it will automatically take care of updating all the needed CDS Views and Entities.
Thanks,
Sijin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Sijin_Chandran,
can you please, explain this: @AbapCatalog.internal.setChange: 'FLDADD_NO_ASS_INFLUENCE'
And how do you know names to use (Es. A_PurchaseOrderItem, E_PurchasingDocumentItem,R_PurchaseOrderItem, Persistence)?
I tried to expand API Sales Order, on S4HANA ON-PREMISE system, adding a standard field missing on API_SALES_ORDER_SRV, following your steps, but doesn't work. I try to add OrderID (VBAP-AUFNR).
@AbapCatalog.sqlViewAppendName: 'ZSD_EXT'
@EndUserText.label: 'Extension view for SalesOrder'
extend view A_SalesOrderItem with ZA_SalesOrderExt
//extend view E_SalesDocumentItemBasic with ZA_SalesOrderExt
{
I_SalesOrderItem.OrderID
}
@AbapCatalog.sqlViewAppendName: 'ZE_SD_EXT'
@EndUserText.label: 'Extension view for SalesOrder'
extend view E_SalesDocumentItemBasic with ZE_SALESORDEREXT
{
Persistence.aufnr as OrderID
}
Actually I can see the new field using GET method, but I cannot use it for POST/PATCH. Filling the new field the order is correctly created, but the field is empty.
POST Order by Postman
GET Order created by Postman
Get order saved using VA01 with OrderID filled
Thank a lot!
Fabrizio
Hello @Sijin_Chandran ,
how do you know which correct CDS needs to be extended regarding adding standard fields in API_Purchase_Order, which in this case you enhance the 'E_PurchasingDocumentItem'.
In my case, I would like to add standard field in API API_CUSTOMER_RETURN_SRV, in item level; field MatlAccountAssignmentGroup (VBAP-KTGRM) to work in POST method. I tried with extending CDS View A_CustomerReturnItem, however only GET operations works like as you mention earlier. Any advice?
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.