Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
D1V4KAR
Explorer
732

Integrating Business Partner Data: When to POST vs PATCH in SAP Standard APIs

In the world of SAP S/4HANA integrations, the Business Partner (BP) object plays a crucial role. It acts as a unified master data hub, representing entities like customers, vendors, and contacts — combining roles, addresses, communication details, and more into a single, streamlined structure.

D1V4KAR_0-1745394556054.png

In our scenario, Business Partner data is sourced from an external MDM system (like MDMHUB) and sent to SAP S/4HANA using standard OData APIs. The goal? Seamlessly support both the creation of new BP entities and updates to existing ones — using POST and PATCH respectively.

 

So, what's the challenge?

With PATCH, things get a bit more complex. Unlike POST, where you're simply creating new records, PATCH allows for partial updates — and each segment of the Business Partner (e.g., address, role, bank data) can require a different operation. That means the integration logic has to decide at runtime whether to create or update each part of the BP structure

D1V4KAR_1-1745394627064.png

 

Handling Operations Dynamically

To make this work smoothly, the integration begins by looking up the current state of the Business Partner in SAP. Based on that, a hashset is built — capturing existing entities and their attributes. This acts as a reference point to determine whether incoming data from MDM should trigger a POST (create) or PATCH (update) operation. 

Below is the code for creating the HashSet and saving it as a property:

def void setHash(String[] input,String[] setName, Output output, MappingContext context) {
        HashSet<String> localSet = new HashSet<>();
        
        for(String inp:input){
            localSet.add(inp);
        }
        context.setProperty(setName[0],localSet);
        output.addValue("0");
}

D1V4KAR_2-1745395055941.png

 

Keeping it clean with batch processing

D1V4KAR_4-1745395124862.png

All of this is wrapped into a single batch request using change sets. This approach offers a few big wins:

  • Groups related operations into one transactional unit

  • Reduces the number of API calls

  • Simplifies error handling by tying related updates together

 

POST vs PATCH

D1V4KAR_5-1745395224311.png

In complex data structures like SAP Business Partner, entities are often interdependent—such as roles, addresses, and contact details. A static approach to handling operations could lead to duplicate records, update failures, or inconsistent data states. Implementing dynamic method determination using lookups and hashsets ensures that only necessary changes are made, reduces load on the system, and prevents unnecessary API failures. This handling becomes especially important when processing high volumes of data or when operating in real-time scenarios.

Regards,

Divakar.

3 Comments
Labels in this area