Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

remote function call - catching technical exceptions

rainer_hbenthal
Active Contributor
0 Likes
2,800

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_INFO

but 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.

1 ACCEPTED SOLUTION
Read only

pole_li
Active Participant
0 Likes
1,326

Hi,

Please check in SE38, some programs begin with SRFC* , maybe something you need.

Pole

5 REPLIES 5
Read only

pole_li
Active Participant
0 Likes
1,327

Hi,

Please check in SE38, some programs begin with SRFC* , maybe something you need.

Pole

Read only

MarcinPciak
Active Contributor
0 Likes
1,326

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

Read only

Former Member
0 Likes
1,326

Hi,

You can use the code below:

try.

Call Function "ABC" destination "XYZ".

Catch cx_root.

raise error.

endtry.

Read only

former_member182371
Active Contributor
0 Likes
1,326

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

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,326

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.