Batch processing with ODataV4 Adapter in SAP CPI
SAP CPI offers OData adapter to communicate with OData services. It supports messages with JSON as well as Atom format. The message protocol in CPI can be either OData V2 or OData V4. You can use either OData V2 or OData V4 depending on the OData service you need to communicate with. More details on the difference between V2 and V4 is available at – https://help.sap.com/doc/saphelp_uiaddon20/2.05/en-US/ab/d4d7c7548d4c29ab8364d3904a6d74/frameset.htm
This blogs explains the procedure to process batch processing (using operation POST ) in OData V4 service receiver OData Adapter.
Configure the adapter as per the instruction – https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/cd66a12cc2054e36a5dfa6b93d56c7bb.html
In OData V2, batch processing can be enabled using the below option:
However with OData V4 this option is not available. In order to process the request SAP has provided the below operations:
In order to send batch data the Operation ‘Batch Processing ($batch)’ needs to be selected.
After selecting the operation, add either a ‘Changeset’ or a ‘Batchset’. I have added ‘Batchset’ and selected the entity ‘Logs’ for this scenario:
This will generate an EDMX file, the structure of the payload looks like this:
The field <method> denotes the operation to be performed, in this scenario we will be using ‘POST’. Provide the entity name in the field <uri>, in this case it will be ‘Logs’.
The remaining fields can be mapped as per your requirement. It is mandatory to have at least one ‘batchSet1’ in a batch request payload. Note that structure should looks something like this after the mapping:
Deploy the iflow and trigger a message, this would post all the records in a single call.