cancel
Showing results for 
Search instead for 
Did you mean: 

Custom entities in SAP Graph

former_member841574
Discoverer

Hi,

I would like to add a custom OData API to SAP Graph and I would like to define special entities of this custom API as local data source to a predefined Entity.

Example: add reference to custom Entity custom.Customer to sap.graph.BusinessPartner. Is that somehow possible with Key Mapping rules in the Graph config file?

Furthermore, I would like to change the key mapping of sap.graph.BusinessPartner. In my case, field ExternalID of sap.c4c.IndividualCustomerCollection should be mapped to field Customer in sap.s4.A_BusinessPartner (instead of field BusinessPartner). Is this doable with key mapping rules in the Graph config file?

Thanks, KR
Herbert

View Entire Topic
avidD
Advisor
Advisor

Hello Herbert,

> I would like to add a custom OData API to SAP Graph and I would like to define special entities of this custom API as local data source to a predefined Entity.

> Example: add reference to custom Entity custom.Customer to sap.graph.BusinessPartner. Is that somehow possible with Key Mapping rules in the Graph config file?

Answer:

No, it is not possible to extend a sap.graph entity with a custom entity. Thus, you will have to define your own view as a projection on custom.Customer.

> Furthermore, I would like to change the key mapping of sap.graph.BusinessPartner. In my case, field ExternalID of sap.c4c.IndividualCustomerCollection should be mapped to field Customer in sap.s4.A_BusinessPartner (instead of field BusinessPartner). Is this doable with key mapping rules in the Graph config file?

Answer:

You are trying to reference a non-key attribute (or alternative key). This is currently not possible. However, we will soon release a new key mapping implementation that allows defining key mappings as foreign keys between data sources, much like in a SQL database. This will provide the functionality you need for key mapping.

In your case, you will be able to declare that sap.c4c.IndividualCustomerCollection.ExternalID references sap.s4.A_BusinessPartner.Customer.

We will let you know once this is released.

Best,
David

former_member841574
Discoverer
0 Kudos

Thanks David!

May you share the latest version of the SAP Graph roadmap, where one can also find the mentioned new key mappings etc.

Is there any plan to offer better extension possibilities (extend sap.graph entities with custom entities, define custom entities as leading sap.graph entities, define navigation between different custom entities coming from different data sources etc.)?

Thanks, KR
Herbert

gregorw
Active Contributor
0 Kudos

Here you can find the SAP Graph Roadmap

avidD
Advisor
Advisor
0 Kudos

Hello,

the new key mapping configuration that you need for your second requirement is now available. Please refer to the updated key mapping blog post for an introduction. You can find the documentation here and here.

In your case, you will want to try out defining this key mapping (with your own data sources):

"keyMapping": [
  {
    "foreignKey": {
      "dataSource": "your-c4c",
      "entityName": "sap.c4c.IndividualCustomerCollection",
      "attributes": ["ExternalID"]
    },
    "references": {
      "dataSource": "your-s4",
      "entityName": "sap.s4.A_BusinessPartner",
      "attributes": ["Customer"]
    }
  }
]

Here, the assumption is that the values of the ExternalID attribute in c4c are a subset of the values of the Customer attribute in s4. Furthermore, the Customer values must be unique for the A_BusinessPartner.

Best regards,

David