SAP S/4HANA OData Connector 2.5 Batch Operations - Mule 4
The batch processing feature is available in SAP S/4HANA OData Connector 2.1 and later.
You must follow the correct order for structural batch operations, which is as follows:
-
Initiate the batch before adding any requests into it.
-
Do not add requests to the batch or the change set after it is executed.
Create a Batch Operation
To create and process a batch operation, you must:
-
Place the Initiate Batch operation in the Mule flow, which returns a unique batch identifier.
This unique batch identifier must be stored, for example, in the flow variable, so that it can then be used to group the batch data operations under the common batch request. -
Use the Create Change Set operation to create a new change set.
This operation returns a unique change set identifier, which you then use in the Batch Create, Batch Update, Delete Entity, or Batch Execute Function operations to add them to the change set. -
When you complete the batch, use the Execute Batch operation to send the batch request.
The Batch Create Entity, Batch Get Entity, Batch Query, and Batch Execute Function operations return a JSON result, however, the result of these operations cannot be read until the Execute Batch operation is executed.
If you attempt to read the result before the Execute Batch operation is executed, the connector throws an exception. You can store the output of these operations, for instance, into a flow variable, and access the output after the Execute Batch operation is executed.
After the Execute Batch operation is successfully executed, a summary is returned, which contains basic information about the outcome of every batch operation that was included as part of the batch operation. The detailed results of these batch operations are then available to read.
Troubleshooting
Exceptions are thrown in the following circumstances:
-
An operation references a batch identifier that is invalid, either because:
-
It was never initiated.
-
It was already processed as part of an Execute Batch operation.
-
-
The change set identifier used in that batch operation is not valid.