cancel
Showing results for 
Search instead for 
Did you mean: 

Error with Read "expected type is Edm.Binary" using /IWFND/GW_CLIENT

0 Kudos

First and foremost I am a Gateway Newbie... I  created a Gateway service via SEGW to read incident reports in EHS. We are developing a concept mobile application for that will create and read EHS incident reports, based upon HANA PA. I tested the BAPI's  BAPI_BUS1240_GETDETAIL for the read and BAPI_BUS1240_CREATE for the Create (both via SE37 ) and they worked perfectly.   When creating the gateway Models, I am getting the error.

Invalid key predicate type for 'Scenario'. Expected type is 'Edm.Binary'</message>



Yet the entity type it is defined as the following


Scenario1Edm.Binary000
KeyDate1Edm.DateTime000
RecordNo0Edm.String0020
CreatedOn0Edm.DateTime000
CreatedBy0Edm.String0012
Incident1Edm.String0020
Type0Edm.String003
Plant0Edm.String004
Status0Edm.String005
Event0Edm.String0060
DamageType0Edm.String0021
FunctLoc0Edm.String0030
Equipment0Edm.String0018
Langu0Edm.String00



Here is the URL I am submitting via /IWFND/GW_CLIENT


/sap/opu/odata/sap/ZINC_SRV/Zinc(Scenario='00',KeyDate='2014-05-06T00:00:00',Incident='00000000000000000016')


What am I doing wrong?



Thanks for all of the assistance!!!


Chris


Accepted Solutions (0)

Answers (1)

Answers (1)

lukasz_grochal
Participant
0 Kudos

In the URL you've got Scenario='00' - I bet this is being interpreted as a string being sent and the service is expecting a Binary value.

According to OData documentation type Edm.Binary is an array of bytes up to 64 KB in size. Are you sure the type should be Binary? Won't Edm.String work?

0 Kudos

thank you for your response..

In SEGW, when I tried to change the Data Model Entity Set Property of Scenario from Edm.Binary to Edm.String, I get a hard Error.  "data source Attribute SCENARIO and model Property scenario have different types".  So I am not sure what to do here

Any advice is welcome. 

Do i have to handle this with ABAP?

Chris

lukasz_grochal
Participant
0 Kudos

The problem is that the SCENARIO import parameter in BAPI_BUS1240_GETDETAIL is defined as type RAW in SAP. That is why it gets converted to Edm.Binary when you map your Gateway operation to an RFC function module. I'm not even sure you can effectively use this type as the key in GET_ENTITY (or how to build a URL that would work). What I'd do is create a ZBAPI wrapper function module where SCENARIO would be defined as string. In the new fm I'd convert the string coming from the OData request to RAW. Please take a look at this post to see how a conversion can be done: . Just keep in mind you have to do that in the other direction.