This example shows how a background unit is locked for processing.
The DELAY method has been defined in the interface IF_BGRFC_UNIT and no alias is used.
Instead of the LOCK method, we use the DELAY method here to allow processing automatically after a defined amount of time. Since DELAY was defined in the interface IF_BGRFC_UNIT and no alias was used, then the call must be performed in the form specified below (this may be subject to changes).
The unit is written to the database as a locked unit. The procedure for bgRFC type q units is identical.
DATA: my_destination TYPE REF TO if_bgrfc_destination_inbound,
my_unit TYPE REF TO if_trfc_unit_inbound,
lock_id TYPE bgrfc_lock_id,
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.
lock_id = my_unit->delay( 300 ). COMMIT WORK.