cancel
Showing results for 
Search instead for 
Did you mean: 

How to deal with Rfc Exception in SOAP TO RFC scenrio?

Former Member
0 Kudos

I have created a simple scenrio "SOAP TO RFC"  to reverse delivery orders.

Generally,it works fine.

But one day ,when i reverse a delivery order which it is  in editing.

The Pi server return "Server Error" as it can not find a proper mapping for RFC exceptions.

So .i try to do this in SE37 .The RFC application throws exception message as follows:

Please help me to deal with this exception message to prevending from server error.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi all:

the problem i faced is all most our custom RFCs are not handle exceptions.

So i want to know .if we do not modify custom RFC.Is there any way in PI to solve this problem.

Former Member
0 Kudos

Hi again, the error you describe probably occures when calling a standard SAP function module inside your custom RFC, so the error has to be handled in the back-end, inside your custom RFC, in the ABAP code. PI cannot handle this type of error

As I wrote, inside your custom RFC, you have to handle the exception by adding the following to the parameter list of the function modules you call inside your custom RFC:

  EXCEPTIONS  

     ... 

    error_message  = 1

If you study the SAP help link I provided, you will understand, the following is important:

If the error_message addition is specified after EXCEPTIONS, all MESSAGE statements that are executed during the processing of the function module and do not have the RAISING addition are affected as follows:

So e.g. if your RFC you call from PI is named Z_THIS_RFC_IS_CALLED_FROM_PI,

function z_this_rfc_is_called_from_pi.

     ...

  call function 'SD_DELIVERY_UPDATE_1'

    exporting

     ...

    tables

     ...

    exceptions

     ...

     error_message       = 1.

     ...

endfunction.

Martin

PeterJonker
Active Contributor
0 Kudos

If you do not handle your exceptions in the RFC function modules then you will make your life unnecessary difficult. By the way it is also good practice to have exception handling programmed in the FM.

Now because you did not, you have a challenge. I think you should solve this at the base. The error is caused in ECC and because you don;t handle or raise an exception in ECC  you also won't be able to handle it in PI easily.

ambrish_mishra
Active Contributor
0 Kudos

Hi Yang,

Since the exceptions are raised in backend because custom FM do not handle them, you need to modify the custom code to handle the exceptions. Even as a best practices, you need to use try..catch blocks wherever you can in the code to handle exceptions. There is no way you can handle them in PI.

Ambrish

Answers (4)

Answers (4)

JaySchwendemann
Active Contributor
0 Kudos

Hi,

have a look at this blog

http://scn.sap.com/people/jin.shin/blog/2007/05/21/handling-web-service-soap-fault-responses-in-sap-...

If you use a self created RFC you may add several exceptions to the RFC. If you raise an exception it will be handled as application error by PI.

You may also have a look at this thread, unfortunately not having a satisfying answer yet to handle multiple errors like in a bapiret table

https://scn.sap.com/thread/3330573

HTH

Cheers

Jens

Former Member
0 Kudos

hi:

your blog is great!

but the problem i faced is all most our custom RFCs are not handle exceptions.

So i want to know .if we do not modify custom RFC.Is there have any way in PI to solve this problem.

a sample exception message :

- <rfc:ZSD_REVERSE_GOODS_ISSUE.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
  <Name>RFC_ERROR_SYSTEM_FAILURE</Name>
  <Text>½»»õ (700521712) ÕýÓÉ´¦ÀíÁíÒ»¸öÓû§ (SDXQWLFH) ´¦Àí</Text>
  </rfc:ZSD_REVERSE_GOODS_ISSUE.Exception>
the Text field have a bad encoding in Chinese.

JaySchwendemann
Active Contributor
0 Kudos

Hi Yanjie,

thanks but actually the blog is not mine 🙂 Kudos go to Jin Shin.

Regarding your situation.

If I get things right according to the posts all around here you are calling a standard FM within your custom FM. Your custom FM is already used in multiple places and you don't want to make changes to the signature (import / export / exceptions) of the FM.

While I understand your general reasons not to change a widely used FM you should really consider going that way because right now all your programs that call the FM would probably crash / cause a dump if things go wrong in the standard FM within the custom FM.

That being said: You may probably play around with just creating a MESSAGE within your custom FM when the standard FM gave you an error. That way you won't need to add an exception for every possible error the standard FM or your own code is creating.

Cheers

Jens

ambrish_mishra
Active Contributor
0 Kudos

Hi,

The error message you are receiving is because the delivery you are accessing, is being edited in ECC.

Basically your question is around error handling for the scenario. Does the RFC response structure has sub-structure for handling errors? If yes, do a reverse mapping which populates the error code to the SOAP response and sends it back to the source system.

If you can provide more details, it will help us help you further

Ambrish

Former Member
0 Kudos

Hi, which RFC are you calling from PI? I recommend to use standard BAPIs if existing for your requirement since they have proper error handling.

If it is a custom RFC you call from PI, you have to handle this exception by adding the error_message addition to the parameter list of the function module you call from your custom RFC.

Please refer to SAP help to learn about the addition, e.g.

CALL FUNCTION 'SD_UPDATE_DELIVERY...'

  EXPORTING

     ...

  IMPORTING

    ...

  TABLES

    ...

  EXCEPTIONS

     ...

    error_message  = 1

    .

Regards, Martin

Former Member
0 Kudos

Hi,Martin:

thanks.The Custom RFC contains many RFC call.we can't deal with every possible exceptions.
So  i dont' want to modify this RFC in every call function statment.
i find this exception message all contains "Name" and "Text" field as follows.
The structure is all the same.
So i want to handle this exceptions in PI
- <rfc:ZSD_REVERSE_GOODS_ISSUE.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
  <Name>RFC_ERROR_SYSTEM_FAILURE</Name>
  <Text>½»»õ (700521712) ÕýÓÉ´¦ÀíÁíÒ»¸öÓû§ (SDXQWLFH) ´¦Àí</Text>
  </rfc:ZSD_REVERSE_GOODS_ISSUE.Exception>
the Text field have a bad encoding in Chinese.

Former Member
0 Kudos

we can't deal with every possible exceptions.

why not?

So  i dont' want to modify this RFC in every call function statment.

why not?

allamudi_loordh
Active Participant
0 Kudos

Hi yang,

try for adding fault message structure in your operation mapping. there are some standard fault messages available in PI you can use of them. When RFC is not sending back response automatically these fault structures will be triggered.

Regards,

Loordh.

Former Member
0 Kudos

Loodrdh:

thanks.I have trid to handle this exception message by fault message.but as our self-created RFC doesn't not deal with exceptions and i dont' want to modify this RFC in every call function statment.

so i suppose if there exist a way in PI to deal with this Exceptions messages.

i find this exception message all contains "Name" and "Text" field as follows.

- <rfc:ZSD_REVERSE_GOODS_ISSUE.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions">

  <Name>RFC_ERROR_SYSTEM_FAILURE</Name>

  <Text>½»»õ (700521712) ÕýÓÉ´¦ÀíÁíÒ»¸öÓû§ (SDXQWLFH) ´¦Àí</Text>

  </rfc:ZSD_REVERSE_GOODS_ISSUE.Exception>

the Text field have a bad encoding in Chinese.

allamudi_loordh
Active Participant
0 Kudos

Hi Yang,

the problem is PI can't alone execute the Fault exceptions.. some where from SAP program it has to come..  we have recently implemented this for proxy.. so you can think of .

Regards,

Loordh.