This example shows how you can lock, retroactively or in advance, the processing of qRFC units of type q that use a specific queue.
In this example, we use the outbound procedure.
In the 'QUEUE_TOP' queue, the next unit to be processed is locked. In the 'QUEUE_BOTTOM' queue, the next unit to be written to this queue is locked.
DATA: my_destination TYPE REF TO if_bgrfc_destination_outbound,
dest_name TYPE bgrfc_dest_name_outbound,
queue_name TYPE qrfc_queue_name.
dest_name = 'MY_DEST'.
queue_name = 'QUEUE_TOP'.
cl_qrfc_lock_outbound=>lock_queue_from_top(
queue_name = queue_name
dest_name = dest_name
ignore_duplicates = abap_true )
queue_name = 'QUEUE_BOTTOM'.
cl_qrfc_lock_outbound=>lock_queue_from_current_pos(
queue_name = queue_name
dest_name = dest_name
ignore_duplicates = abap_true ).