Using "Mixed Mode"

The special feature of "mixed mode" is that qRFC calls with outbound queue and normal tRFC calls are processed together within one LUW. For more information about characterizing “mixed mode", see qRFC with Outbound Queue: Overview.

Prerequisites

See Programming Serialization.

Procedure

When implementing "mixed mode" within an LUW, note the following:

If within an LUW in "mixed mode" the first call is a normal tRFC call, you must first of all call function module TRFC_QUEUE_INITIALIZE. This assures that the current LUW is processed using qRFC with outbound queue.
If within an LUW in "mixed mode" the first call is a qRFC call, this initialization is done by function module TRFC_SET_QUEUE_NAME.

This program sequence is an example of how to implement an LUW in "mixed mode":

REPORT ... .

...

DATA Q_NAME LIKE TRFCQOUT-QNAME.

CALL FUNCTION 'TRFC_QUEUE_INITIALIZE'.

CALL FUNCTION 'RFC_FUNCTION_1'           " tRFC call -> NO QUEUE

           IN BACKGROUND TASK 

           DESTINATION 'DEST'

           EXPORTING ...

           TABLES ... .

  ...

Q_NAME = 'BASIS_TEST_Q1'.

CALL FUNCTION 'TRFC_SET_QUEUE_NAME' 

           EXPORTING 

                   QNAME = Q_NAME.

CALL FUNCTION 'RFC_FUNCTION_2'           " qRFC call -> Q1

           IN BACKGROUND TASK 

           DESTINATION 'DEST'

           EXPORTING ...

           TABLES ... .

  ...

CALL FUNCTION 'RFC_FUNCTION_N-1'          "tRFC call -> NO QUEUE

           IN BACKGROUND TASK 

           DESTINATION 'DEST'

           EXPORTING ...

           TABLES ... .

Q_NAME = 'BASIS_TEST_QM'.

CALL FUNCTION 'TRFC_SET_QUEUE_NAME' 

           EXPORTING 

                   QNAME = Q_NAME.

CALL FUNCTION 'RFC_FUNCTION_N'           " qRFC call -> QM

           IN BACKGROUND TASK 

           DESTINATION 'DEST'

           EXPORTING ...

           TABLES ... .

  ...

COMMIT WORK.

Result

Because of the transaction characteristics, the normal tRFC calls and the qRFC calls with the same destination form a unit. If, however, within the current LUW there are no qRFC calls for a destination, the system bundles the normal tRFC calls into a sub LUW.

The normal tRFC calls with the addition AS SEPARATE UNIT map a separate LUW in the target system.

qRFC calls with the addition AS SEPARATE UNIT are processed depending on the queue, but independent of the actual LUW.

To start programming in "mixed mode", refer to the demo program RSTRFCT1.

Transaction Sequence and Queue Assignment