Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

What to return from GetEntity if requested record is not found?

$
0
0

Hi,

 

In my implementation of the GetEntity method I select the requested record from the database according to the key values passed to the method.

In case the requested record could not be selected because it doesn't exist, I simply return the empty (initial) er_entity.

This works in most cases and leads to an error like this:

 

       "errordetails" : [

         {

           "code" : "/IWBEP/CX_MGW_BUSI_EXCEPTION",

           "message" : "Resource not found for segment 'ContractVersion'",

           "propertyref" : "",

           "severity" : "error",

           "target" : ""

         }

       ]

 

In case my entity has fields of type Edm.DateTime which are mapped to ABAP type TIMESTAMP then I will receive an error like this:

 

   "error" : {

     "code" : "0050569259751EE4BA9710043F8A5115",

     "message" : {

       "lang" : "en",

       "value" : "In the context of Data Services an unknown internal server error occurred"

     }

 

 

In the Gateway error log the error info is "Invalid format (return structure): Property Name 'ChDateTime',  Property Value '0 '"

 

So what shell be done if the requested entity is not found?

Should I manually raise an exception in the getEntity method?

Any other proposals or best practice?


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>