Exception Handling for Web Services created with the Web Service Creation Wizard

One of the great features of the SAP Connector for Microsoft .NET was the ability to throw a BAPI Exception in case the BAPI return structure contains an error. Today most people use Visual Studio 2005 and the Web Services the newer SAP releases offer (since WebAS 6.20 and fully WS-I compliant since NetWeaver Application Server 6.40).

The question is now how to handle the BAPI Exception in case of using Web Services. André Fischer from SAP published a blog at https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5758 where he introduces a .NET based “checker” class which checks the return parameter of the called BAPI and which throws an error of type SAP.NetWeaver.BAPI.BapiException in case that at least in one of the entries of the Return parameter the field Type is filled with A (abort) or E (error).

I tested the SAP.NetWeaver.BAPI.BapiException class and it worked great, I tested the class with the Web Services created by the Web Service Creation Wizard. I’m not sure whether it will work with the Web Service Interface provided since WebAS 6.20, if you will do this please let me know the result!

- Juergen