tRFC (transactional or asynchronous RFC)
A tRFC is simply a renaming of what was known as asynchronous RFC. This is achieved by calling an RFC in a background task. So an tRFC call always looks like this:
call function 'funcname'
in background task
Doing so, the RFC will be executed asynchronously from the calling application, i.e. it is executed in its own transactional environment. This may be necessary if the immediate execution of the RFC cannot be guaranteed, e.g. when using a leased line or registered service, so that the receiver is online only during certain periods. The tRFC calls will be queued and executed when the receiver is online again.
BAPI transaction chains via RFC
BAPI RFCs are transactional by definition, i.e. a BAPI must not commit its work automatically. This allows to call multiple BAPIs in a sequence and then decide to COMMIT WORK or ROLLBACK WORK for the whole thing. Hence, you can build your own transactions by doing a sequence of BAPI calls. The COMMIT WORK and ROLLBACK are done with the special system BAPIs BAPI_TRANSACTION_COMMIT and BAPI_TRANSACTION_ROLLBACK.
tRFC (asynchronous RFC) from external clients
To my knowledge, calling an RFC in background task is not supported from external sources. I could imagine a workaround by calling the standard
DATA: program type standard table of abaptext. APPEND 'CALL FUNCTION 'SAVE_TEXT' TO program. APPEND 'IN BACKGROUND TASK' TO program. .... CALL FUNCTION 'RFC_ABAP_INSTALL_AND_RUN' EXPORTING MODE = 'F' PROGRAMNAME = '<<RFC1>>' * IMPORTING * ERRORMESSAGE = TABLES program = program * writes =
This function allows execution of an arbitrary ABAP via RFC. The ABAP code is passed to the function as a text table. So you construct the necessary call and pass it to RFC_ABAP_INSTALL_AND_RUN which is used as a shuttle for your ABAP call. Because you want to make an asynchronous call, you do not have to wait for any response and can call the actual function module IN BACKGROUND TASK.
This was first published in June 2003