Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
23,748
This blog explains how Business Partner master data can be maintained in a SAP S/4 HANA Cloud system using OData APIs. OData APIs allow the creation and consumption of queryable and interoperable REST methodologies in a simple and standard way. These API's offer light-weight connection option for data transfer with SAP S/4HANA systems.The OData service API_BUSINESS_PARTNER is available on SAP API Business Hub, it can be used to maintain master data related to Business Partner, Customer and Supplier entities.

Prerequisites:

  • A Communication User for SAP communication Scenario: SAP_COM_0008 (Business Partner, Customer and Supplier Integration). Please refer the document on how to create Communication User and Arrangements.

  • A REST client like Postman.


Procedure:

1)  Launch Postman Client.

  • In the authorization tab, set the type as "Basic Auth".

  • Enter the communication username and password.

  • HTTP method: GET

  • URI: https://<system_path>/sap/opu/odata/sap/API_BUSINESS_PARTNER/$metadata

  • HTTP Response 200 OK indicates the successful load of the metadata.

  • The entity data model of the service can be understood by the metadata of the service.




 

2) To keep it simple, we shall create a Business Partner with basic details like name, address and tax entities.

  • HTTP method: POST

  • URI: https://<system_path>/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner

  • JSON:
    {
    "BusinessPartnerCategory" : "2",
    "OrganizationBPName1" : "SAP",
    "to_BusinessPartnerAddress" : [ {
    "Country" : "DE",
    "StreetName" : "Dietmar-Hopp-Allee 16",
    "PostalCode" : "69190",
    "CityName" : "Walldorf",
    "to_AddressUsage" : [ {
    "AddressUsage" : "XXDEFAULT" } ]
    } ],
    "to_BusinessPartnerTax" : [ {
    "BPTaxType":"DE0",
    "BPTaxNumber":"DE012345678"
    }] }

  • HTTP response 201 Created, indicates successful creation and the Business Partner Number (1000075) for the entity created is available in the response.


 

 

3) Let us update the "OrganizationBPName1" attribute of the created entity from "SAP" to "SAP SE".

  • HTTP method: PATCH

  • URI: https://{system_path}/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('1000075')

  • JSON:
    { "OrganizationBPName1" : "SAP SE" }

  • HTTP response 204 No Content, indicates successful update.


 

 

4) Let us read the complete data of the created Business Partner using $expand property.

  • HTTP method: GET

  • URI: https://{system_path}/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('1000075')?$expand=to_BusinessPartnerAddress,to_BusinessPartnerTax

  • HTTP response 200 OK, indicates successful read. 


 

5) Let us see how to delete the tax number for the created Business Partner.                                        (Note : It is not possible to delete the BusinessPartner entity, but some of its associated child entities can be deleted.)

  • HTTP method: DELETE

  • URI: https://{system_path}/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartnerTaxNumber(BusinessPartner='1000075',BPTaxType='DE0')

  • HTTP response 204 No Content, indicates successful delete. 


The above illustrated examples are very simple, same steps can be followed for other entities and attributes in the service. Extensibility is supported in this service. Please refer to my previous blog Add Custom fields to SAP S/4HANA Business Partner OData API Entities for further details.       Looking forward to your questions and feedback in the comments section.

 

 

 

 
18 Comments