Solution to Avoid Dump that appears when we use Commit work before the Standard Commit
In certain cases, we use commit work before the standard commit happens. This usually doesn’t create problem in case of custom reports.
But while using the same amidst the user exits or BADI we sometimes get a standard dump. This blog post gives you a detailed note on the reason for the dump and solution for the same.
My requirement was to send a mail after mass release of production order using COHV transaction. The mail includes details of released production order. This step of sending mail is handled inside at release method in Work Order Update BADI. I used SO_NEW_DOCUMENT_SEND_API1 function module to send mail. While trying to execute, the program got terminated due to the below dump.
Reason for the Dump:
On further analysis, it has been found that we can commit work only after certain points of the program. As we were trying to commit the work forcefully before that point, it resulted in dump.
This issue can be resolved using call function with destination as none. In general call function with destination RFC is used when you are using the call function in one system, but your data needs to be fetched from other system. For example, fetching data from ECC system, which is to be used in BI. RFC destinations are created in SM59.
In our case we used the same SO_NEW_DOCUMENT_SEND_API1 with destination none. When destination is given as none, it actually points to the same system.
(FM works on the same application server as a calling program). Now, the conflict between the standard commit and our commit has been handled. This has resolved my dump.
Whenever we are using a call function which requires commit inside the user exit or BADI or enhancement spots and face this error, we can use the same call function with destination none .