This video discusses the theory and practical aspects of using the $batch operation in OData. Here’s a summary:
- Purpose of $batch: The $batch operation is used to process data in parallel. It allows for creating, reading, updating, and deleting in one single call, instead of making multiple calls or using the expand query. This is done by putting all the query options in one batch and executing them in one go in the application layer.
- Parallelization: The video discusses how to activate parallelization of batch queries in the SAP system. It’s important to note that while parallel read operations can be performed, change operations cannot be executed in parallel. The number of parallel queries that can be run is defined in the system settings, and it’s recommended to set this number with system performance in mind.
- Change Sets: A change set groups one or more operations (insert, update, delete) that are executed in a single SAP Logical Unit of Work (LUW). If an operation within a change set fails, all operations within that change set will not be performed. This is because all operations within a change set are performed within a single SAP LUW, ensuring an all-or-nothing transaction behavior.
- Deeper Mode: The video introduces a new method called “ChangeSet Process” in addition to the existing “ChangeSet Begin” and “ChangeSet End” methods. This new method is used when there are multiple operations within a change set. If the “ChangeSet Process” method is not implemented and multiple operations are attempted within a change set, an error will be returned stating that the default change set implementation allows only one operation.
- System Requirements: The video mentions that some features, like parallel processing and the “ChangeSet Process” method, are only available in SAP system version 7.4 and support package 9 and above.
- Practical Examples: The video provides examples of how to structure payloads for $batch operations with multiple change sets and operations. It also shows how to implement the “ChangeSet Process” method and how to set the CV Defer Mode to ‘X’ to call this method instead of the default entity set methods.
This video is a deep dive into the $batch operation in OData, and it provides a mix of theoretical knowledge and practical examples. It’s particularly useful for developers working with SAP and OData.