2009 Mar 26 2:57 PM
Hi,
When I call a function in RFC mode, I would like to catch the exceptions to don't display a horrible dump but rather a error message.
The exceptions that I would like to catch are :
- CALL_FUNCTION_NO_DEST
- CALL_FUNCTION_NOT_REMOTE
- CALL_FUNCTION_REMOTE_ERROR
...
When I use the syntax :
CATCH SYSTEM-EXCEPTIONS CALL_FUNCTION_NOT_REMOTE = 1.
ENDCATCH.I have a syntax error : "system-exception" expected, not "CALL_FUNCTION_NOT_REMOTE".
I see in ABAP Keyword Documentation that for the CALL FUNCTION syntax, the Runtime errors aren't catchable....
What I do?
Regards.
Xavier.
2009 Mar 26 3:06 PM
Instead of capture exceptions you can do
CALL FUNCTION 'RFC_VERIFY_DESTINATION'
EXPORTING
DESTINATION = V_DESTINATION
TIMEOUT = 5
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 EQ 0.
" Call Your RFC here
ELSE.
" Make a Error message
ENDIF.
a®
2009 Mar 26 3:06 PM
Instead of capture exceptions you can do
CALL FUNCTION 'RFC_VERIFY_DESTINATION'
EXPORTING
DESTINATION = V_DESTINATION
TIMEOUT = 5
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 EQ 0.
" Call Your RFC here
ELSE.
" Make a Error message
ENDIF.
a®
2009 Mar 30 2:39 PM
The function 'RFC_VERIFY_DESTINATION' allow to return the error RFC connection as I want but, in the integration system, everybody SAP users haven't the object authorization 'S_RFC_ADM'. So, the function isn't useable.
Another process allow to control RFC connection without particulary authorization object?
Edited by: Xavier Couloumies on Mar 30, 2009 3:39 PM
2010 Feb 19 5:20 PM
Hi Xavier,
I was coming across the same problem, Googled it and came across your thread. Although a little late on replying and am sure you've got around your problem.
But for others, who are coming across the same problem... and i quote from SAP online help..
" Function module calls with the addition DESTINATION can handle two special system exceptions:
SYSTEM_FAILURE
This is triggered if a system crash occurs on the receiving side.
COMMUNICATION_FAILURE
This is triggered if there is a connection or communication problem.
In both cases, you can use the optional addition
... MESSAGE mess
to receive a description of the error."
so you simply add the following code at the end of RFC FM
Call Function
DESTINATION lv_rfc_dest
....
EXCEPTIONS
system_failure = 1
communication_failure = 2
OTHERS = 99.
Message text example
Data: lv_error_text(100) TYPE c
Call Function
DESTINATION lv_rfc_dest
....
EXCEPTIONS
system_failure = 1 MESSAGE lv_error_text
communication_failure = 2 MESSAGE lv_error_text
OTHERS = 99.
here is the complete reference http://tinyurl.com/ykvf99x
best regards,
Asim
2024 Oct 30 6:52 AM
It seems reasonable to check this before the FM call. Cheers!