cancel
Showing results for 
Search instead for 
Did you mean: 

Adaptive RFC Exception Message Text

Former Member
0 Kudos

Hi.

How does one get the specific message text for an exception raised by the RFC? The given code in the tutorials only show the name of the exception, ie.

catch (WDDynamicRFCExecuteException ex)

{

manager.reportException(ex.<i>getMessage()</i>, false);

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you can get the specific message text for any exception in Java by calling exception.getMessage() and excption.getLocalizedMessage() methods. This calling will return the exact error message as in the caught exception. After that you can process the message as you wish.

regards,

Shubhadip

Former Member
0 Kudos

exception.getLocalizedMessage() only returns "null".

Any ideas?

faB

Former Member
0 Kudos

Hi,

getLocalizedMessage always retuns null and I actually don't know what to do with is but regarding the RFC error situation is following:

1. If Model represent a BAPI then you have RETURN2 structure which contains STATUS and MESSAGE0 fields. The after invalidationg the output you can simply chek the status and if status is FAIL,ERROR or WARNING print the MESSAGE0 field using manager.reportMessage

2. If RFC is not BAPI then all it's ABAP exception are maped to Java exception and ex.getMessage is best you can do.

3.There are some RFCs which has their custom mechanism to report error in all sort of the output fields then you simply should check this field and print them in case they indicates the errors.

Hope it helps.

Victor.

Former Member
0 Kudos

Hi,

there is currently no way to get the ABAP exception text / message as it is not transported into the ARFC by the underlying layers of the ARFC model. You will only be able to get the ID using the mentioned

WDDynamicRFCExecuteException.getMessage()

method. If this ID is not sufficient the recommendation is to do explicit error handling in your RFC (e.g. using the BapiRet2 structure mentioned by Victor).

Regards,

Patric.

Former Member
0 Kudos

Patric Ksinsik

Hi,

Is there any SP (support packages) to solve this problem?

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Did u mean to show a message given by the RFC.

If yes, u can get the return message in the catch block and show that message using message manager.

The return message can be captured in the similar way u r getting the output.

This will be helpful enough if I understand ur question correctly.