Académique Documents
Professionnel Documents
Culture Documents
Summary
We expose an RFC enabled function module as web service in R/3.
While creating the function module, we specify the exceptions that should be raised under the exceptions
tab. When we execute this function module we get just the Exception Name not the Exception Text
maintained against that exception.
Here I will show how to change the exception name in the virtual interface of the web service as well as how
to specify the complete and meaningful exception text in the web service response.
Author(s): Pushkar Anand
Company: Deloitte
Created on: 29 May 2007
Author Bio
I have been working as an SAP ABAP & XI Consultant. Having worked on end to end SAP XI
implementations and the basis activities, now I am moving towards ESA and SOA. XI, ALE and
ESA are my key areas
Table of Contents
Exception Handling Description ....................................................................................................... 3
How to over write the exception name ............................................................................................ 5
How to add more meaningful Exception Text.................................................................................. 7
Related Content............................................................................................................................... 8
Source Code :
When I use Raise Exception in the ABAP code it returns just the exception name i.e.EXCEPT1 in the
fault message as shown in the payload attached below.
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Client</faultcode>
<faultstring xml:lang="en">EXCEPT1</faultstring>
<detail>
<n0:Zpl.Exception xmlns:n0="urn:sapcom:document:sap:soap:functions:mc-style">
<Name>EXCEPT1</Name>
<Text/>
</n0:Zpl.Exception>
</detail>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>
Now we edit the Exception field in Service Interface as EXCEPTION_PUSHKAR as shown below.
And now on executing this web service the exception in the fault message is EXCEPTION_PUSHKAR
as shown in the payload attached below.
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Client</faultcode>
<faultstring xml:lang="en">EXCEPTION_PUSHKAR</faultstring>
<detail>
<n0:Zpl.Exception xmlns:n0="urn:sapcom:document:sap:soap:functions:mc-style">
<Name>EXCEPTION_PUSHKAR</Name>
<Text/>
</n0:Zpl.Exception>
</detail>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope
And now on testing the web service, the fault message contains Exception Name, Exception Text,
Message Id as well as Message No.
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Client</faultcode>
<faultstring xml:lang="en">EXCEPTION_PUSHKAR</faultstring>
<detail>
<n0:Zpl.Exception xmlns:n0="urn:sapcom:document:sap:soap:functions:mc-style">
<Name>EXCEPTION_PUSHKAR</Name>
<Text>EXCEPTION TEXT FOR PUSHKAR !!</Text>
<Message>
<ID>ZPLATINO</ID>
<Number>001</Number>
</Message>
</n0:Zpl.Exception>
</detail>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>
Related Content
Please include at least three references to SDN documents or web pages.
https://weblogs.sdn.sap.com/pub/wlg/3982
https://www.sdn.sap.com/irj/sdn/enterprisesoa
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c019bf26-8bb8-2910-4f8fe9bd55eda650