Skip to Content

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.

 

 

 

 

To report this post you need to login first.

4 Comments

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

  1. Former Member

    Thanks for the great blog! I’m having an issue assigning a business partner role to the the business partner. I have tried during the POST function and also tried to PATCH the BP but neither method is working. Could there be an issue with the service?

    (0) 
  2. Manasi Sridhar Post author

    Hi,

    Please use the below json format for assigning role (say : FLCU00 )  to BP using HTTP method : POST on entity A_BusinessPartner.

    {
    “BusinessPartnerCategory” : “2”,
    “OrganizationBPName1” : “SAP”,
    “to_BusinessPartnerAddress” : [ {
    “Country” : “DE”,
    “StreetName” : “Dietmar-Hopp-Allee 16”,
    “PostalCode” : “69190”,
    “CityName” : “Walldorf”,
    “to_AddressUsage” : [ {
    “AddressUsage” : “XXDEFAULT” } ]
    } ],
    “to_BusinessPartnerRole” : [ {
    “BusinessPartnerRole”:”FLCU00″
    }] }

    Regards,

    Manasi Sridhar

     

    (0) 
  3. Kalpana C

    Hi Manasi,

    Since in BusiessPartner API’s “A_CUSTOMER” EntitySet there is no “POST” operation mentioned, can you please tell how to create a Customer, or which EntitySet to be used for Creating a Customer ?

    Thanks,

    Kalpana.

    (0) 
  4. Manasi Sridhar Post author

    Hi Kalpana,

    When a BP is created with a customer role, Customer would be created. My previous comment has a payload of such an example. In case some customer specific data also need to created, make sure to pass the payload accordingly via “to_Customer” association when posting on A_BusinessPartner entity.

    Regards,

    Manasi Sridhar

     

    (0) 

Leave a Reply