Skip to Content
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

  1. So one should not copy paste the $metadata files but should download the same.
  2. 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 ); 

 

 

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.