FM exception in BW system
It seems a function module (developed in a BW system) cannot raise an exception when called from an external system through a middleware.
Any hint? Thanks.
You can't trap ABAP exceptions when calling from an external system. This is because there isn't an abap context which called the function call which would receive the function module's exceptions up the program callstack and make use of them. In other words you can only use those exceptions when you are calling the FM from ABAP.
There's an alternative approach utilised with many BAPIs which are RFM enabled FMs intended for SAP and third party system use.
They have as TABLES parameter an object called a return table. This table contains messages in a standard format which you can receive into your third party system (or SAP system if RFC) and then handle from there. Search for BAPI* in SE37 to find examples, click the TABLES tab.
Hope that helps.