Skip to Content
Technical Articles
Author's profile photo A Madhubala

Solution to Avoid Dump that appears when we use Commit work before the Standard Commit

Introduction:

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.

Main Problem:

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.

Solution:

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.

 

 

Conclusion:

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 .

 

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sandra Rossi
      Sandra Rossi

      That's also explained in the documentation of COMMIT WORK:

      • The statement COMMIT WORK cannot be executed in updates or during the execution of subroutines registered using PERFORM ... ON {COMMIT|ROLLBACK}.
      • The statement COMMIT WORK must not be executed in units or LUWs that are managed by background RFC calls (bgRFC and the (obsolete) tRFC, qRFC).

      As the user exits which concern "save" are often called during the update tasks, it's recommended to not call COMMIT WORK.

       

      Author's profile photo A Madhubala
      A Madhubala
      Blog Post Author

      Thanks Sandra for the additional information .

      Author's profile photo ARPITH BHAT
      ARPITH BHAT

      Hello Madhu,

      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.

      Author's profile photo Naga Seerla
      Naga Seerla

      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

      Exception: CX_SY_OPEN_SQL_DB

      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.

      Thanks,

      Naga

      Author's profile photo Martin Svik
      Martin Svik

      Great blog, it helps me out with an issue with sending mails 🙂

      Author's profile photo Lars Schmittgen
      Lars Schmittgen

      Very helpful blog. I have this problem when i call a webservice out of a BaDi Enhancement. Is there a solution for this case?

      Author's profile photo Karthik s
      Karthik s

      Hi Madhu,

      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.

       

      Regards,

      KArthik S