*&---------------------------------------------------------------------*
*& Report ZTS_QRFC_CALL
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zts_qrfc_call.
PARAMETERS: p_sec TYPE i DEFAULT 10,
rfcdest LIKE rfcdes-rfcdest DEFAULT 'NONE',
P_QNAME LIKE TRFCQIN-QNAME DEFAULT 'MY_QUEUE'.
PARAMETERS: p_out RADIOBUTTON GROUP ra1,
p_in RADIOBUTTON GROUP ra1.
INITIALIZATION.
%_p_sec_%_app_%-text = '等待时间(秒)'.
%_rfcdest_%_app_%-text = '远程调用目标'.
%_p_out_%_app_%-text = '出站队列'.
%_p_in_%_app_%-text = '入站队列'.
%_p_QNAME_%_app_%-text = '队列名称'.
START-OF-SELECTION.
CASE 'X'.
WHEN p_in.
PERFORM frm_qrfc_inbound.
WHEN p_out.
PERFORM frm_qrfc_outbound.
ENDCASE.
*&---------------------------------------------------------------------*
*& Form FRM_QRFC_INBOUND
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_qrfc_inbound .
CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
EXPORTING
* QOUT_NAME = ' '
qin_name = P_QNAME
* QIN_COUNT =
* CALL_EVENT = ' '
* NO_EXECUTE = ' '
EXCEPTIONS
invalid_queue_name = 1
OTHERS = 2.
CALL FUNCTION 'Z_BC_TEST_QRFC'
IN BACKGROUND TASK
AS SEPARATE UNIT
DESTINATION rfcdest
EXPORTING
iv_wait = p_sec
EXCEPTIONS
communication_failure = 1
system_failure = 2
resource_failure = 3
OTHERS = 4.
COMMIT WORK. "提交才会写入队列
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_QRFC_OUTBOUND
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_qrfc_outbound .
*队列可以先注册, 也可以不注册
CALL FUNCTION 'TRFC_SET_QUEUE_NAME'
EXPORTING
qname = P_QNAME
* NOSEND = ' '
* TRFC_IF_SYSFAIL = ' '
* CALL_EVENT = ' '
EXCEPTIONS
invalid_queue_name = 1
OTHERS = 2.
CALL FUNCTION 'Z_BC_TEST_QRFC'
IN BACKGROUND TASK
AS SEPARATE UNIT
DESTINATION rfcdest
EXPORTING
iv_wait = p_sec
EXCEPTIONS
communication_failure = 1
system_failure = 2
resource_failure = 3
OTHERS = 4.
COMMIT WORK. "提交才会写入队列
ENDFORM.