The Business Partner service (BP service) is taking care of the calls going to the SAP S/4HANA Cloud system in order to load all the business partners (franchisees) of the customer.
The service is deployed in the namespace integration of the Kyma account.
Here is a detailed overview of the BP service connections:
- The BP service reads BusinessPartners from the SAP S/4HANA Cloud system via an OData v.2 API.
- The BP service requests also other information from the DB Service, for example, the subdomain name for the current tenant.
- The BP service provides a json API, which will be called by the Easy Franchise service.
OData (Open Data Protocol) is a standard that defines a set of best practices for building and consuming REST APIs. A metadata document defines available entities and methods. With this metadata, you are able to execute read/filter/create/update/delete Rest APIs to manipulate entities. See the OData documentation for more details.
Read the following section Enable the Business Partner OData V2 Rest API in an SAP S/4HANA Cloud system, which explains you how to enable the OData V2 Rest Endpoint for a communication arrangement user.
The Business Partner data model is exposed via the following GET request (use Basic Auth with the communication arrangement user):
https://<your s4 endpoint>/sap/opu/odata/sap/API_BUSINESS_PARTNER/$metadata
As we want only the Entity for A_BusinessPartner, we need to restrict the request:
https://<your s4 endpoint>/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner
To consume the data without using an OData Java library, we are transforming it to JSON by adding --header 'Accept: application/json'
to the REST call.
For our scenario, we are only interested in Business Partners of category Organization. Here is an example of a request:
https://<your s4 endpoint>/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner?$filter=BusinessPartnerCategory eq '2' & $expand=to_BusinessPartnerAddress/to_EmailAddress
Here a JSON example showing the structure of the response (in reality there are much more properties!):
{
"d": {
"results": [
{
"BusinessPartner": "10100001",
"BusinessPartnerFullName": "Inlandskunde DE 1",
"to_BusinessPartnerAddress": {
"results": [
{
"BusinessPartner": "10100001",
"AddressID": "22807",
"CityName": "Schoental",
"Country": "DE",
"StreetName": "Lindenstrasse",
},
"to_EmailAddress": {
"results": [
{
"AddressID": "22807",
"IsDefaultEmailAddress": true,
"EmailAddress": "[email protected]",
}
]
},
}
]
},
},
{
"BusinessPartner": "10100002",
...
},
... all other BusinessPartners
]
}
}
The BP service is a Java module of the parent pom:
<project>
<modules>
<module>bp-service</module>
...
</modules>
</project>
BPService.java implements the REST services. The method getBusinessPartner first gets the destination details (SAP S/4HANA Cloud URL and authorization properties) from the destination configured in the subaccount and then performs the OData request against the SAP S/4HANA Cloud system.
The path of all APIs begins always with /easyfranchise/rest/bpservice/v1/<TENANT-ID>
. It is then followed by the path listed below for each individual REST call.
Path | Description | Curl Example |
---|---|---|
bupa | Get all BusinessPatners | curl --verbose --request GET 'http://<localhost:8100>/easyfranchise/rest/bpservice/v1/<tenantid>/bupa' |