Skip to Content

Entity with binary key in a SAP Gateway Service

Jul 11, 2017 at 02:28 PM


avatar image

Hello everyone,

I just created a SAP Gateway Service with an entity, which uses a GUID (ABAP type RAW 16) as key (like “00155DEDEF921ED7919022D2200320C3”).

In all request responses that key seems to be converted to a base64 representation like “ABVd7e+SHteRkCLSIAMgww==” which results in the following problem:

If I start a new request for one single entity like /sap/opu/odata/sap/MY_GATEWAY_SERVICE/EntityTypeSet(‘ABVd7e+SHteRkCLSIAMgww==’) I receive the following error message: “Invalid key predicate type for 'KEY'. Expected type is 'Edm.Binary'“.

The only valid request seems to be /sap/opu/odata/sap/MY_GATEWAY_SERVICE/ EntityTypeSet(binary'00155DEDEF921ED7919022D2200320C3'), which uses the hex representation of the guid.

However, as I always get the base64 representation of the guid in all request responses I have no idea how to create valid requests.

Can anyone help me and explain how to use GUIDs as key.

Thanks in advance and best regards,
Michael Liermann

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Dominik Steinrücken Jul 25 at 09:01 AM

Hi Michael

Please check the OData-Type (EDM.Core Type) of the GUID field in your SEGW project.
If the property type is Edm.Binary change it to Edm.Guid (and delete the value for max. length)

After that the Entity Key should be

Best regards

10 |10000 characters needed characters left characters exceeded
Michael Liermann Jul 26 at 06:44 AM

Hi Dominik,

this was exactly the solution I sucessfully applied.


10 |10000 characters needed characters left characters exceeded