As an example, my task is to create thousands of customers and contracts in our system. In order to completely create a customer, I must call a number of BAPIs. If a customer is incomplete because one of its BAPIs results in an error, then I must rollback the BAPI changes for only that customer.
Currently, I solve this issue by committing and waiting (waiting is required so that I can then proceed to create the contracts) for each customer when it completes successfully, or rolling-back when it is unsuccessful. However, committing and waiting for each customer is time-consuming.
Therefore, I would like to know how I can only commit and wait every X number of customers, but still rollback an individual customer when it is not created completely. I would like to accomplish this using ABAP Objects, that is, using classes/methods rather than functions.