Show TOC

Examples for Inbound and Outbound ProcessingLocate this document in the navigation structure

Use

The following simple examples help to explain how the new API is used:

  • bgRFC Type t: Outbound

  • bgRFC Type q: Outbound

  • bgRFC Type q: Outbound to Inbound

  • bgRFC Type t: Inbound

  • bgRFC Type q: Inbound

bgRFC Type t: Outbound

This example creates a bgRFC unit type t that contains two function module calls and which is sent to a remote system via the outbound scheduler.

          


          
DATA: my_destination TYPE REF TO if_bgrfc_destination_outbound,
          
my_unit TYPE REF TO if_trfc_unit_outbound,
          
dest_name TYPE bgrfc_dest_name_outbound.
          


          
dest_name = 'MY_DEST'.
          
my_destination = cl_bgrfc_destination_outbound=>create( dest_name ).
          
my_unit = my_destination->create_trfc_unit( ).
          
CALL FUNCTION 'rfc_function_1' IN BACKGROUND UNIT my_unit.
          
CALL FUNCTION 'rfc_function_2' IN BACKGROUND UNIT my_unit.
          
COMMIT WORK.
          


          


            

qRFC Type q: Outbound

This example creates a bgRFC unit type q that contains two function module calls and which is sent to a remote system via the outbound scheduler. To do this, queue names are used for the serialization of units. At the same time, the example explains how to intercept exceptions to be able to handle any errors. In this example, we will specify the queue names retroactively. This is technically correct, but the maintenance of the programs can suffer as a result.

          


          
DATA: my_destination TYPE REF TO if_bgrfc_destination_outbound,
          
my_unit TYPE REF TO if_qrfc_unit_outbound,
          
dest_name TYPE bgrfc_dest_name_outbound,
          
queue_name TYPE qrfc_queue_name,
          
queue_names TYPE qrfc_queue_name_tab.
          


          
TRY.
          
dest_name = 'MY_DEST'.
          
my_destination = cl_bgrfc_destination_outbound=>create( dest_name ).
          
CATCH cx_bgrfc_invalid_destination.
          
MESSAGE e102(bc).
          
ENDTRY.
          
my_unit = my_destination->create_qrfc_unit( ).
          
TRY.
          
CALL FUNCTION 'rfc_function_1' IN BACKGROUND UNIT my_unit.
          
my_unit->add_queue_name_outbound( 'DEBITOR-1234' ).
          
CALL FUNCTION 'rfc_function_2' IN BACKGROUND UNIT my_unit.
          
queue_name = 'PRODUCT-4711'.
          
INSERT queue_name INTO TABLE queue_names.
          
queue_name = 'PRODUCT-5432'.
          
INSERT queue_name INTO TABLE queue_names.
          
my_unit->add_queue_names_outbound( queue_names ).
          
CATCH cx_qrfc_duplicate_queue_name.
          
MESSAGE e101(bc).
          
ENDTRY.
          
COMMIT WORK.
          


          


            

bgRFC Type q: Outbound to Inbound

The next example creates a bgRFC unit of type q that contains two function module calls and which is sent to a remote system using the outbound scheduler. Once there, it is placed in the inbound queue. To do this, queue names are used for the serialization of units. At the same time, we show how you can disable the exception raised for duplicate queue names, using the parameter IGNORE_DUPLICATES.

          


          
DATA: my_destination TYPE REF TO if_bgrfc_destination_outbound,
          
my_unit TYPE REF TO if_qrfc_unit_outinbound,
          
dest_name TYPE bgrfc_dest_name_outbound,
          
queue_name TYPE qrfc_queue_name,
          
queue_names TYPE qrfc_queue_name_tab.
          


          
TRY.
          
dest_name = 'MY_DEST'.
          
my_destination = cl_bgrfc_destination_outbound=>create( dest_name ).
          
CATCH cx_bgrfc_invalid_destination.
          
MESSAGE e102(bc). ENDTRY.
          
my_unit = my_destination->create_qrfc_unit_outinbound( ).
          
CALL FUNCTION 'rfc_function_1' IN BACKGROUND UNIT my_unit.
          
CALL FUNCTION 'rfc_function_2' IN BACKGROUND UNIT my_unit.
          
queue_name = 'DEBITOR-1234'.
          
INSERT queue_name INTO TABLE queue_names.
          
queue_name = 'PRODUCT-4711'.
          
INSERT queue_name INTO TABLE queue_names.
          
queue_name = 'PRODUCT-5432'.
          
INSERT queue_name INTO TABLE queue_names.
          
my_unit->add_queue_names_outbound( queue_names = queue_names
          
ignore_duplicates = abap_true ).
          
my_unit->add_queue_names_inbound( queue_names = queue_names
          
ignore_duplicates = abap_true ).
          
COMMIT WORK.
          


          


          


          


            

bgRFC Type t: Inbound

This example creates a bgRFC unit of type t that contains two function module calls and which is to be processed in the same system by the inbound scheduler.

          


          
DATA: my_destination TYPE REF TO if_bgrfc_destination_inbound,
          
my_unit TYPE REF TO if_trfc_unit_inbound,
          
dest_name TYPE bgrfc_dest_name_inbound.
          


          
dest_name = 'MY_DEST'.
          
my_destination = cl_bgrfc_destination_inbound=>create( dest_name ).
          
my_unit = my_destination->create_trfc_unit( ).
          
CALL FUNCTION 'rfc_function_1' IN BACKGROUND UNIT my_unit.
          
CALL FUNCTION 'rfc_function_2' IN BACKGROUND UNIT my_unit.
          
COMMIT WORK.
          


            

bgRFC Type q: Inbound

This is another example of an inbound bqRFC of type q. Unlike the bgRFC of type t example, we are using queue names here and, therefore, the method create_qrfc_unit instead of create_trfc_unit.

          


          
DATA: my_destination TYPE REF TO if_bgrfc_destination_inbound,
          
my_unit TYPE REF TO if_qrfc_unit_inbound,
          
queue_name TYPE qrfc_queue_name,
          
queue_names TYPE qrfc_queue_name_tab,
          
dest_name TYPE bgrfc_dest_name_inbound.
          


          
dest_name = 'MY_DEST'.
          
my_destination = cl_bgrfc_destination_inbound=>create( dest_name ).
          
my_unit = my_destination->create_qrfc_unit( ).
          
TRY.
          
CALL FUNCTION 'rfc_function_1' IN BACKGROUND UNIT my_unit.
          
my_unit->add_queue_name_inbound( 'DEBITOR-1234' ).
          
CALL FUNCTION 'rfc_function_2' IN BACKGROUND UNIT my_unit.
          
queue_name = 'PRODUCT-4711'.
          
INSERT queue_name INTO TABLE queue_names.
          
queue_name = 'PRODUCT-5432'.
          
INSERT queue_name INTO TABLE queue_names.
          
my_unit->add_queue_names_inbound( queue_names ).
          
CATCH cx_qrfc_duplicate_queue_name.
          
MESSAGE e101(bc).
          
ENDTRY.
          
COMMIT WORK.
          
DATA