‎2010 Sep 03 6:14 AM
Hi,
i need to catch some exceptions in a customer report with a remote function call. Its for the business, presenting them a dump is not acceptable.
The remote function itself deliveres application exceptions - thats no problem.
But i would like to check some things in advance:
- is the remote system available?
- is a logon with rfcdest possible?
- does the function module exists?
Some things can be checked by
RFC_GET_SYSTEM_INFObut at least may be someone has a better way of checking. Especially if the function module is in existance i do not have a glue on how to check that. I hoped that maybe there is a system exception which i can catch via TRY, but i douoldnt find anythin in the online help.
‎2010 Sep 03 7:10 AM
Hi,
Please check in SE38, some programs begin with SRFC* , maybe something you need.
Pole
‎2010 Sep 03 7:10 AM
Hi,
Please check in SE38, some programs begin with SRFC* , maybe something you need.
Pole
‎2010 Sep 03 8:03 AM
I don't think there is a need of checking that before FM call. Each RFC function defines two implicit exceptions:
- COMMUNICATION_FAILURE
- SYSTEM_FAILURE
Both can be added to the list of catched exceptions so you would not raise a dump if for some commucation or other error occur.
Try it out.
Regards
Marcin
‎2010 Sep 03 8:16 AM
Hi,
You can use the code below:
try.
Call Function "ABC" destination "XYZ".
Catch cx_root.
raise error.
endtry.
‎2010 Sep 03 9:49 AM
Hi,
before calling your RFC try using fm RFC_VERIFY_DESTINATION.
e.g.
.
CALL FUNCTION 'RFC_VERIFY_DESTINATION'
EXPORTING
destination = g_dest
EXCEPTIONS
internal_failure = 1
timeout = 2
dest_communication_failure = 3
dest_system_failure = 4
update_failure = 5
no_update_authority = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
* then call here your RFC
ENDIF.
.
Best regards.
Edited by: Pablo Casamayor on Sep 3, 2010 10:50 AM
‎2010 Sep 03 10:43 AM
in Addition to the helpful answers: catchable exceptions can be found in the online documentation for a normal call function. I just had a look in the rfc call function, but the normal ones are working fine even with destination.