Commit in RFC function module called in background task (tRFC)

Hello everyone,

I’m currently struggling with a design perspective. I need to call a BAPI_GOODSMVT_CREATE in a User-Exit.

As we know, it’s strongly recommended to commit the change after the BAPI call with BAPI_TRANSACTION_COMMIT, or, in case of errors, BAPI_TRANSACTION_ROLLBACK.

But, it not permitted to commit in User-Exit/BAdI. One of the solutions is to wrap the BAPI with the commit/rollback in RFC Function, and call it in sRFC/aRFC mode (but an implicit commit take place in the calling program), or, call it in Background Task (tRFC).

If I go with tRFC mode, the documentation say:

“The statements COMMIT WORK  and ROLLBACK WORK  must not be executed within a LUW. In addition, no implicit database commit  can be triggered there.”

When I read other post on the subject, there are some answers which “allow” a commit in this FM. I think I’m OK with that but I would have your thoughts on about this… Is it really OK to bending the rules for this kind of need? Or maybe I’m just overthinking it a little bit and should go with the answers already given 😅?


Can we use BAPI inside Customer Exits or BADIs? 

Is it ok to use commit work in a FM called in a background task ? 

And also, if commit inside tRFC must not happen, it means that every DB update in function called in this mode only depend of an implicit commit at the end of the process?

Thanks !

Scroll to Top