PARAMETERS: p_rfc TYPE rfcdest.
START-OF-SELECTION.
* Nachschauen, ob RFC-Verbindung vorhanden
SELECT SINGLE d~rfcdest, d~rfctype, d~rfcoptions, t~rfcdoc1, t~rfcdoc2, t~rfcdoc3
INTO @DATA(lv_rfc)
FROM rfcdes AS d
INNER JOIN rfcdoc AS t ON ( d~rfcdest = t~rfcdest )
WHERE d~rfcdest = @p_rfc
AND t~rfclang = @sy-langu.
IF sy-subrc = 0.
WRITE: / '[', p_rfc, ']', lv_rfc-rfcdest, lv_rfc-rfctype, lv_rfc-rfcoptions, lv_rfc-rfcdoc1, lv_rfc-rfcdoc2, lv_rfc-rfcdoc3.
DATA: lv_err_msg TYPE char255.
* wenn RFC-Verbindung vorhanden -> anpingen und Systemfehler (Dumps) abfangen
CALL FUNCTION 'RFC_PING' DESTINATION p_rfc
EXCEPTIONS
system_failure = 1 MESSAGE lv_err_msg
communication_failure = 2 MESSAGE lv_err_msg
OTHERS = 3.
IF sy-subrc = 0.
* RFC-Ping ok
WRITE: / '[', p_rfc, '] RFC-Aufruf erfolgreich.'.
ELSE.
* RFC-Ping fehlerhaft
WRITE: / '[', p_rfc, '] RFC-Aufruf gescheitert:', lv_err_msg.
ENDIF.
ELSE.
* RFC-Verbindung nicht vorhanden
WRITE: / '[', p_rfc, '] RFC-Verbindung nicht vorhanden.'.
ENDIF.