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 .
That's also explained in the documentation of COMMIT WORK:
As the user exits which concern "save" are often called during the update tasks, it's recommended to not call COMMIT WORK.
Thanks Sandra for the additional information .
A very informative blog. It would be very useful for many consultants who would do this mistake during ABAP coding.
Would be awaiting for many more such blogs from you.
Hello A Madhubala
Could you please look into the error I am getting and let me know if you could help:
Scenario: I am calling FM SO_NEW_DOCUMENT_SEND_API1 in an extra field in SQ02. my intention is to send an email based on a report executed in SQ01 transaction.
I have used ‘COMMIT WORK’ statement and ‘DB COMMIT’ function module with no luck. I have also included DESTINATION ‘NONE’ with the function module but getting the following dump.
Runtime error: DBSQL_INVALID_CURSOR
Under “What can I do”: It might be possible to remedy this with command OPEN CURSOR WITH HOLD, using function module DB_COMMIT.
Please let me know if I should include any specific information pertaining to the dump.
Great blog, it helps me out with an issue with sending mails 🙂
Very helpful blog. I have this problem when i call a webservice out of a BaDi Enhancement. Is there a solution for this case?
Its a good one.
I have a doubt on below scenario -
I have an output type where the medium is MAIL.
In the driver program, at the end ...after using BCS class method to send mails...can i use commit work statement ? ie for the driver program.
If not, is there alternate option to use commit work in that so that when multiple orders processed...mails will be sent to different users.