Advertising:
COMMIT-WORK required or causing FMs (BAPIs) and classes in RAP
From SAP Knowledge Base
Anyone who uses the ABAP RESTful Application Programming Model (RAP) to develop apps encounters the problem of using function modules or classic classes that require a COMMIT WORK, already call a COMMIT WORK themselves or use other non-permitted keywords such as IN UPDATE TASK.
With regard to the COMMIT WORK, the RAP framework only allows this in the SAVE sequence, but not in between, where the FuBas or classes with the above-mentioned keywords may be used.
The workaround for these function modules or classes is therefore to run them in a new/own LUW. This means that this code is executed asynchronously alongside the app.
One possibility is to call it with RFC destination 'NONE'.