cancel
Showing results for 
Search instead for 
Did you mean: 

Passing SAP Exceptions to a sync SOAP Call

Former Member
0 Kudos

Hi,

I have a scenario in which I have exposed a RFC as a Web service through XI. My sender is SOAP sender who invokes XI which inturn calls the RFC in SAP.

When there is any Error or exception triggered from SAP i.e invalid userid or Insufficient Authorization error I want to capture these errors and send it back to the Sender SOAP system.

I understand that I can use Fault messages but the fault message would be triggered only when my RFC throws an Exception. IF SAP triggers an exception even before the call reaches the RFC then how do I handle these errors??

Pls advice.

Thanks

Ashish

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi, can anyone tell me if the solution with APPLICATION_ERROR and bapi return table worked for this problem right now I'm having the exact problem, thanks in advance.

Regards,

Julio Cesar

Former Member
0 Kudos

Hi Ashish,

<b><i> When there is any Error or exception triggered from SAP i.e invalid userid or Insufficient Authorization error I want to capture these errors and send it back to the Sender SOAP system.</i></b>

for this i would advice you to create a tables parameter in RFC of type bapiret1. And update this structure for all the errors occuring with in RFC. BY doing so when an errors occurs in RFC, bapiret is filled and returned to xi which then sent to the soap sender.

<b><i> understand that I can use Fault messages but the fault message would be triggered only when my RFC throws an Exception. IF SAP triggers an exception even before the call reaches the RFC then how do I handle these errors??</i></b>

We have had mixed success with fault messages. But we have found the following characteristic very consistent: we defined in RFC an exception as application exception, which is raised for unhandled exceptions and mapped this to fault message. So when an exception is raised in RFC or while getting to RFC, the message is marked as hard error in SXMB_MONI(different icon). The only downside is that the soap sender gets an error "adaptor failure".

Hope it helps,

Thanks,

Naveen

Former Member
0 Kudos

Hi Naveen,

I am tried to capture the rfc exception being raised from SAP but as of now we are not able to map the System exception to a Fault Message in XI.

1. I defined a fault message in Designer

2. Did interface mapping between RFC exception and the target Fault message that I had defined in step 1.

After i execute a test run I get an exception thrown from SAP but I cannot map it to my fault message.

You mentioned that I need to "RFC an exception as application exception" . How do I do this? my rfc code does not raise any exception. But I do see in MONI an Error mesasge being returned from SAP with the Sender interface as my RFC.

Please advice.

Thanks

Ashish

Former Member
0 Kudos

Hi Ashish,

<i><b>

Step1: In your function builder(se37)</b></i>

1.1 choose exceptions:

define APPLICATION_ERROR as one of the

exceptions.Advantage of defining this exception

is it will catch all unhandled exceptions in RFC

1.2 choose tables:

define return (bapi return). all authorization

errors, or any other exceptions raised with in

the rfc should be populated in return.

<i><b>Step2: import this updated RFC into XI</b></i>

(for example ZRFC_Tst)

<i><b>Step3: In interface mapping with target interface as ZRFC_Tst you will have to do three mappings</b></i>

3.1 Request

3.2 Response : map result

3.3 Fault

map zrfc_tst.Exception to FaultMessage

Thanks,

Naveen

<b></b>

Former Member
0 Kudos

Hi,

I tried your steps but I still cannot map my Error XML Message to a valud Fault Message.

This is my Error XML message being generated from SAP RFC Gateway:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <!-- Call Adapter

-->

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapterFramework</SAP:Category>

<SAP:Code area="MESSAGE">GENERAL</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: RfcAdapter: receiver channel has static errors: can not instantiate RfcPool caused by: com.sap.aii.af.rfc.RfcAdapterException: error initializing RfcClientPool:com.sap.aii.af.rfc.core.repository.RfcRepositoryException: can not connect to destination system due to: com.sap.mw.jco.JCO$Exception: (103) RFC_ERROR_LOGON_FAILURE: Name or password is incorrect. Please re-enter</SAP:AdditionalText>

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

What am I doing wrong? I have a Mapping defined between my RFC Exception and Fault Message but the above xml message is not compatible with my RFC Exception Message schema therefore I do not see any message going back to the SOAP Sender.

The scenario is that the RFC Receiver comm channel between XI and SAP has an invalid userid. My guess is that even before the call reaches to the RFC , SAP gives this error as XI cannot connect to SAP R/3 with an invalid userid.

I want to capture the above error message and send it back to the SOAP caller. As of now he gets a bad java stack trace which does not mean anything.

Please advice.

Thanks

Ashish

Former Member
0 Kudos

Hi Ashish,

If there were to be an error in XI(like the one you mentioned) to my best knowledge we cannot trap that message and send it back to the soap caller. The caller will always end up with an " failed to call the adapter engine" message.

Thanks,

Naveen

Former Member
0 Kudos

> Hi Ashish,

>

> If there were to be an error in XI(like the one you

> u mentioned) to my best knowledge we cannot trap that

> message and send it back to the soap caller. The

> caller will always end up with an " failed to call

> the adapter engine" message.

>

> Thanks,

> Naveen

Not necesarily;

It purely depends on which type of exception has been generated on XI i.e. a Runtime, application specific, etc.. exception???

You could of course implement your own SOAP adapter extensions in Java and "catch" possible exceptions so you can send the correct error message to the SOAP client.

Cheers,

Roberto

Former Member
0 Kudos

Thanks for the post. As of now we need to trap System specific Exceptions like SAP R/3 is down or Authorization error for the SOAP caller when he tries to invoke the SAP RFC>

Would it be possible for you to send me a sample of a custom SOAP Adapter that you have developed? I just wanted to see the design.

Thanks

Ashish

Former Member
0 Kudos

hi.

u have given the proper answer but there u hav mapped fault message to application_error (exception)

then how u will map the error came from tables return bapi.

waiting for you.

regards.

seeta.