For each custom business object you can generate an OData service by selecting “Service Generation”:

The service generated has the technical name of the custom business object with _CDS as suffix. To access the service from an integration tool like SAP Cloud Platform Integration you need to setup a communication scenario in the app “Custom Communication Scenario”. Afterwards you have to create a communication arrangement for this scenario. You will see the URL of your OData service in the inbound section:

 

Custom Business Object OData Service Overview

The OData Service of a custom business object is an OData service of version 2.0. You find the official OData Version 2.0 documentation at http://www.odata.org/documentation/odata-version-2-0.

The service has a technical key and a semantic key. The semantic key is the key that was defined in the custom business object as key fields. When creating entries through HTTP method POST the semantic key is taken into account. The technical key is the field SAP_UUID. For all changes or deletions of entries through HTTP methods PUT,MERGE or DELETE the technical key must be provided to the URI. To read entries OData version 2.0 provides two options. You can read a specific entry with HTTP method GET by providing the technical key in the URI. Otherwise you can read multiple entries also through HTTP method GET by using the paging and filter functionality. With this possibility you can also read a specific entry by providing the semantic key to the filter.

The OData service supports batch processing. For performance reasons you should always use batch processing. When interacting with the OData service you should take care of the session handling (see blog post How to Call OData Services in SAP Hybris Marketing Cloud).

 

Sample Requests

The following sample requests are built for a custom business object named YY1_HCI_ID_ID_ORIGIN. The custom business object has 4 fields whereas field IDOrigin and ContactID are marked as keys.

  1. Retrieve the metadata of the OData service:
    GET https://my<...>-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_HCI_ID_ID_ORIGIN_CDS/$metadata​
  2. Create an entry (Semantic Key Fields: IDOrigin, ContactID):
    POST https://my<...>-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_HCI_ID_ID_ORIGIN_CDS/YY1_HCI_ID_ID_ORIGIN
    
    {
    
     "IDOrigin":"EXTERNAL",
    
     "ContactID": "1",
    
     "Field1" : "Max",
    
     "Field2" : "Mustermann"
    
    }
  3. Retrieve the technical key SAP_UUID for a specific entry:
    GET https://my<...>-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_HCI_ID_ID_ORIGIN_CDS/YY1_HCI_ID_ID_ORIGIN?$select=SAP_UUID&$filter=IDOrigin eq 'EXTERNAL' and ContactID eq '1'
  4. Update an entry:
    MERGE https://my<...>-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_HCI_ID_ID_ORIGIN_CDS/YY1_HCI_ID_ID_ORIGIN(guid'00163e0c-0f31-1ee7-8ddd-7e166e5da27f')
    
    {
    
     "Field2" : "Musterfrau"
    
    }
  5. Delete an entry:
    DELETE https://my<...>-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_HCI_ID_ID_ORIGIN_CDS/YY1_HCI_ID_ID_ORIGIN(guid'00163e0c-0f31-1ee7-8ddd-7e166e5da27f')
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply