‎2008 Nov 03 6:27 AM
REPORT yfi1_trfcmonitor.
*----
TABLE Declarations
*----
TABLES: trfcqin. "#EC *
*----
INTERNAL TABLE Declarations.
*----
DATA: it_err_queue TYPE STANDARD TABLE OF trfcqin, " Internal table for error queues
it_app_queue TYPE STANDARD TABLE OF trfcqin, " Internal table for first LUW
it_qtable TYPE STANDARD TABLE OF trfcqin,
it_trfcqins TYPE STANDARD TABLE OF trfcqins,
it_qiwklist TYPE STANDARD TABLE OF qiwktab,
fields LIKE sval OCCURS 0 WITH HEADER LINE. " Internal table of current queues
it_qview TYPE STANDARD TABLE OF trfcqview.
*----
Variable Declarations.
*----
DATA: v_acttid TYPE arfctid, " Transaction ID
reg_qname LIKE qrfcevent-qname,
range_tab LIKE RANGE OF reg_qname,
range_line LIKE LINE OF range_tab.
rmqdest LIKE rfcdes-rfcdest,
subrc LIKE sy-subrc.
rfcmess(72),
p_title(60) TYPE c,
retcode TYPE c,
globalfield(100),
globalline LIKE sy-linno.
*----
Work Area Declarations
*----
DATA: wa_qiwklist TYPE qiwktab, " Work area of type qiwktab
wa_queue LIKE it_err_queue,
wa_err_queue LIKE trfcqin,
wa_app_queue LIKE trfcqin,
wa_trfcqins TYPE trfcqins,
wa_qview TYPE trfcqview. " Work area of type trfcqview.
*----
selection parameters
*----
PARAMETERS: client LIKE sy-mandt DEFAULT sy-mandt,
qname LIKE trfcqin-qname DEFAULT 'XBTR*'.
SELECT-OPTIONS: qtab FOR trfcqin-qname NO-DISPLAY ."default '*'
client = sy-mandt.
Getting all the queues
CALL FUNCTION 'QIWK_GET_ALL'
EXPORTING
client = client
TABLES
qiwklist = it_qiwklist.
LOOP AT it_qiwklist INTO wa_qiwklist
WHERE qname = qname.
Getting all the error queues
CALL FUNCTION 'TRFC_QIN_GET_ERROR_QUEUES'
EXPORTING
client = sy-mandt
TABLES
qtable = it_err_queue.
LOOP AT it_err_queue INTO wa_err_queue.
*getting the first LUW.
CALL FUNCTION 'TRFC_QIN_GET_FIRST_LUW'
EXPORTING
qname = wa_err_queue-qname
no_read_lock = 'X'
IMPORTING
tid = v_acttid
TABLES
qtable = it_app_queue
EXCEPTIONS
OTHERS = 1.
*save the current LUW.
READ TABLE it_app_queue INTO wa_app_queue INDEX 1.
IF sy-subrc EQ 0.
DELETE FROM trfcqin
WHERE arfcipid = wa_app_queue-arfcipid AND
arfcpid = wa_app_queue-arfcpid AND
arfctime = wa_app_queue-arfctime AND
arfctidcnt = wa_app_queue-arfctidcnt AND
qname = wa_app_queue-qname AND
qcount = wa_app_queue-qcount AND
qstate = 'SYSFAIL'.
*unlock the queue
CALL FUNCTION 'TRFC_QIN_RESTART'
EXPORTING
qname = wa_err_queue-qname
EXCEPTIONS
invalid_parameter = 1
system_failed = 2
communication_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
MOVE-CORRESPONDING wa_app_queue TO wa_trfcqins.
APPEND wa_trfcqins TO it_trfcqins.
ENDIF.
ENDLOOP.
ENDLOOP.
INSERT trfcqins FROM TABLE it_trfcqins.
IF sy-subrc EQ 0.
CLEAR it_trfcqins.
ENDIF.
‎2008 Nov 03 6:36 AM
This programs Unlocks the error queue during Transactional RFC.
When you call a remote system using tRFC, if some error occurs during execution, this program (in the remote system) find out the error logs and unlocks the resources,
‎2008 Nov 03 6:36 AM
This programs Unlocks the error queue during Transactional RFC.
When you call a remote system using tRFC, if some error occurs during execution, this program (in the remote system) find out the error logs and unlocks the resources,