XI/PI: Throwing Generic Exceptions from any type o...
Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
What if you could throw even more generic exceptions from your mappings ?
What does it mean you may ask...
At first we need to define what we'd like to have:
a) our method should allow to inform about the error in ERROR segment of our mapping pipeline service
b) our method should work with every mapping (java, message mapping, abap, XSLT)
c) we should be able to create our method just once and never have to change it again
So it there any way to achieve the above in XI ?
Let me show you one solution:
1. At first we will use any mapping and in case we'd like to throw an exception we will fill dynamic configuration value (we can do it from any type of mapping). In my example I do it from Message Mapping User Defined Function.
2. Then we will create an ABAP mapping class that will do the "hard" part:
a) it will read dynamic configuration
b) if the dynamic configuration will be filled we will raise an exception with the value from dynamic configuration
3. Then we need to add our abap mapping class as a second mapping (right after any mapping in which we execute our "exception") in the Interface Mapping.
4. Next you can try to execute your scenario and you will see that the message ended up with mapping error
5. Now inside the message you can see the error in Error segment of the XI Message.
Thanks to this approach throwing mapping exceptions can become very easy, your administrators will be very happy (as they will get descriptive errors) and you will have one method for all mapping types.