Order split in BADI ORDER_SAVE
I have been experimenting quite a bit with the functions available in the function group CRM_ORDER_API and I have managed to write some code in the BADI ORDER_SAVE, which will allow me to split an order in two different orders based on the distribution channels related to a product in the product master data.
I do however have one problem. My code has three modules
1. Copy split order lines from original order
2. Delete order lines copied from original order
3. Save (or rather call BAPI_TRANSACTION_COMMIT)
If I execute 1 and 3 in ORDER_SAVE method PREPARE, it works fine and I can copy the order I want to copy.
If I execute 2 in ORDER_SAVE method PREPARE it also works fine and the lines I want to delete in the original order are deleted.
If however, I attempt to first copy order lines, then delete the copied lines from the original order and then save, I get the NO_AUTHORITY exception from CRM_ORDER_MAINTAIN. How is this possible, when the individual function modules I have created work OK?
Very best regards,