Well if you observe the Transaction /IWFND/GW_CLIENT i.e SAP Gateway client then you can see there are three HTTP methods for Update operation that are Put,Patch and Merge. So what’s the difference between Put,Patch,Merge. Let’s check out.

difference between put,patch,merge

PUT: This will take the HTTP Request(Payload) as input and the same payload will be received in the Updata_entity method as we have seen in the previous part. e.g – If you pass sales office i.e { “Vbkur” : “170” } then only Vbkur will be visible inside the update_entity. In other words, if a subset of attributes is given as input to the PUT method then the same subset of attributes will be received for processing.

PATCH/MERGE: If a subset of attribute pass in the payload (HTTP Request) then other attribute or properties are fetched automatically. Patch and merge are behave in the same manner but the basic difference is that Patch supports OData 3.0 Protocol wherein Merge supports OData 1.0 & 2.0 Protocol. The patch is preferred over merge. The details can be found in the Link.

Let’s take an example to explain the same 😉

for our order header entity below are the following properties or attributes

    "Vbeln" : "32346",
    "Erdat" : "\/Date(1627171200000)\/",
    "Erzet" : "PT19H29M37S",
    "Ernam" : "FIORIUSER",
    "Audat" : "\/Date(1627171200000)\/",
    "Netwr" : "193.050",
    "Waerk" : "USD",
    "Vkorg" : "1710",
    "Vtweg" : "10",
    "Vkbur" : "180"

For Patch and merge – let suppose we pass only the { “Vkbur” : “180” } as in the payload, let see what will be received at the update_entity method

patch http method
debug update_entity method
payload during debugging patch operation

Wondering how other properties are fetched, even though only the Vbkur is passed in the payload? The answer is whenever you trigger a Patch or merge call then it will first trigger to the corresponding GET_ENTITY(collect all properties) method and then the UPDATE_ENTITY method.

actual difference between patch/merge and put

You can check the same in debugging

patch vs merge vs put
difference patch vs merge vs put

Hope this clears the concept of PUT, PATCH & MERGE Operation in OData.

Previous Part: More about Update Operations in OData -Part 8 – ABAP Skill

Next Part:

Check out our ABAP Blogs ABAP – ABAP Skill

1 Comment

How to send messages as a response in OData – Part 10 · August 7, 2021 at 12:25 pm

[…] Previous Part:What is the difference between Put,Patch,Merge OData-Part 9 (abapskill.com) […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *