cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Adapter exceptions

Former Member
0 Kudos

Hi,

I've been going through documentation regarding the RFC receiver adapter and have created a test RFC to try it out.

So what I've done is , I've created a RFC which raises a class exception as follows.

data OREF type ref to CX_MAPPING_FAULT.

try.

raise exception type CX_MAPPING_FAULT

exporting ERROR_TEXT = 'This is the reason'

ERROR_CODE = 'ID Text'

TEXTID = 'Test'.

catch CX_MAPPING_FAULT into OREF.

raise exception OREF.

endtry.

In PI, I map the exception to a fault message but all I keep getting back from the rfc is the following... so my exception text is never sent back... am I doing something wrong ?

<rfc:YTEST_RFC_EXCEPTIONS.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><Name>RFC_ERROR_SYSTEM_FAILURE</Name><Text>An exception that could not be caught occurred.</Text><Message><ID>RFC_ERROR_SYSTEM_FAILURE</ID><Number>null</Number></Message></rfc:YTEST_RFC_EXCEPTIONS.Exception>

Is this really the way to send back application errors from RFC's to PI ? Using global exeptions seems to not return any text.

Is there a way to take BAPI_RET and generate an fault from that in the mapping ?...

Thanks

Thierry

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>Is there a way to take BAPI_RET and generate an fault from that in the mapping ?...

have a look at my blog how:

/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping

Regards,

Michal Krawczyk

Former Member
0 Kudos

Thanks.

any idea about why the class errors information are not returned in PI ? Is there anything wrong with my approach with class exceptions ?

Thierry

Former Member
0 Kudos

In sm21 of the ABAP system , it says that the exception was not caught in the call hiearchy... I thought this way the whole idea... PI would receive it and handle the CX_MAPPING_FAULT... not the UNCAUGHT_EXCEPTION error...

UNCAUGHT_EXCEPTION

CX_MAPPING_FAULT

Am I missing something here ?

Former Member
0 Kudos

Hi ,

your blog indicates how to generate CX_MAPPING_FAULTS , but I think these cause system faults... is there a way to do it but generating application faults ?

Thanks.

Answers (2)

Answers (2)

Former Member
0 Kudos

will open customer message for this issue.

Former Member
0 Kudos

So here is where I'm at with this problem.

What I get back as an exception from the RFC call , I can map to the Fault Message without any problems.

The problem I have is that when I call the RFC, the RFC doesn't return the exception I defined but a RFC_ERROR_SYSTEM_FAILURE exception.

In sm21 of the abap system , this is what I get :

An exception that could not be caught occurred.

Causes

The exception 'CX_AI_APPLICATION_FAULT' was raised but was not caught at any

stage in the

call hierarchy.

Here is the code of my rfc...

FUNCTION YTEST_RFC_EXCEPTIONS.

*"----


""Interface locale :

*" IMPORTING

*" VALUE(ZINPUT) TYPE CHAR10

*" EXPORTING

*" VALUE(ZOUTPUT) TYPE CHAR10

*" RAISING

*" CX_AI_APPLICATION_FAULT

*"----


data OREF type ref to CX_AI_APPLICATION_FAULT.

data TEXT type STRING.

data ID type MPG_ERRCODE.

try.

raise exception type CX_AI_APPLICATION_FAULT

exporting TEXTID = 'Test'.

catch CX_AI_APPLICATION_FAULT into OREF.

raise exception OREF.

endtry.

ENDFUNCTION.

Any help would be appreciated.

Thanks.

Former Member
0 Kudos

I'm wondering, are we limited to raising only specifc exceptions in an RFC... it seems CX_AI_APPLICATION_FAULT is not handled by the calling program.

Any hint would be appreciated guys... I'm not an abaper.