Skip to Content

Entity with binary key in a SAP Gateway Service

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    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
    /sap/opu/odata/MY_SERVICE/MyEntitySet(guid'00505690-6ECF-1ED8-A1A0-F957691DDD21')/

    Best regards
    Dominik

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 26 at 06:44 AM

    Hi Dominik,

    this was exactly the solution I sucessfully applied.

    Thanks,
    Michael

    Add comment
    10|10000 characters needed characters exceeded