Technical Articles
Error messages you might encounter when using the ABAP RESTful programming model
Introduction
When preparing CodeJam Events or customer presentations I ran into the one or other minor issue when developing sample OData Services using the new RESTful ABAP programming model that I would like to share with you. Most of the issues I found will be adressed the one or other way in future releases but nevertheless I wanted to share meanwhile how to get around issues.
Some findings
FETCH API (direct DB access) is not supported for entity
This error will be shown in the SAP Fiori Elements preview if you have accidently created a service binding for a service definition that exposes an abstract entity an have published the service binding as an OData service
The error details are as follows:
This is an example of an abstract entity that shows the described behavior,
/********** GENERATED on 01/24/2019 at 12:33:35 by CB0000000045**************/
@OData.entitySet.name: 'ZC_Be2Ui_ProductReview_Ex4'
@OData.entityType.name: 'ZC_Be2Ui_ProductReview_Ex4Type'
define root abstract entity ZZC_BE2UI_PRODUCTREV57AC70E558 {
key ReviewUUID : sysuuid_x16 ;
key Product : abap.char( 10 ) ;
Rating : abap.dec( 4, 2 ) ;
RatingText : abap.string( 0 ) ;
ReviewedBy : abap.char( 81 ) ;
RatedAt : tzntstmpl ;
}
OData Proxy: Execution of request “POST /sap/bc/adt/businessservices/proxies/getmapping” failed: 500 Internal Server Error
I copied and pasted a $metadata from a browser window and copied the Content into a file. Then imported it to create an OData proxy. The generation process however failed with the following error message:
Execution of request “POST /sap/bc/adt/businessservices/proxies/getmapping” for destination <SID>_EN (system https://xxxxxxxx-cccc-eeee-rrrr-wwwwwwwwwwww.abap.eu10.hana.ondemand.com) failed: 500 Internal Server Error
- So one should not copy paste the $metadata files but should download the same.
- If you run into errors you can doublecheck by trying to Import the file in the Service Builder by selecting in a Service Builder project : Right click on the Folder Data Model and choose Import –> Data Model from file. The Service Builder would return the message “Invalid model file”
Preview app does not show anything on the object page
When you create a CDS view with UI annotations and use the preview functionality you have to provide @UI.facet annotation in order to show data on the object page.
If you just add @UI.identification annotations this will not be sufficient opposed to the scenario where you are using SAP Web IDE to consume the very same service.
define root custom entity ZCE_Product_via_RFC
{
@UI.facet: [
{
id: 'Product',
purpose: #STANDARD,
type: #IDENTIFICATION_REFERENCE,
label: 'Product',
position: 10 }
]
@UI : {
lineItem : [{position: 10, importance: #HIGH}],
identification: [{position: 10}],
selectionField: [{position: 10}]
}
key ProductId : abap.char( 10 );
TypeCode : abap.char( 2 );
@UI : {
lineItem : [{position: 20, importance: #HIGH}],
identification: [{position: 20}],
selectionField: [{position: 20}]
}
Category : abap.char( 40 );
Hi Andre Fischer
I am exposing an Analytical cds view through a Service definiton on a OData V2 service binding. The key annotation on the view is @Anlytics.query:true, to enable usage of @AnalyticsDetails.query.formula annotation on an element.
Now while consuming the entity via SEGW, it always returns a SADL Contract Violation exception , with the error message -
FETCH API (direct DB access) is not supported for entity.
Exposing the same CDS via OData.publish:true work fine.
Any ideas on what causes the error and alternative to expose the CDS via Service Binding?
Regards
Ravish
On S4/2020 exposing CDS views (or CDS entity) with analytical annotations via Service binding is not working and throws above mentioned error.
It works via annotation @OData.publish : true or via SEGW project with reference.
Took me a while to get this knowledge 🙁
Hi Jan, I have the same problem but when I add the @OData.publish : true annotation it says that it's use is not permitted because it is not released. As you say if i expose the entity using a Service binding it returns me the error FETCH API (direct DB access) is not supported for entity. ¿Any help?
Andre Fischer
Not permitted looks like as if you are working either in Steampunk or at least using objects that have the language version "ABAP for cloud development".
You should add more details to your questions and I would suggest to post it in the Q&A section since the comments area is not the right place to have lengthy and deep dive discussions.