Skip to Content

Error handling framework for ABAP proxies – Part 1

“To Err is Human” said Alexander Pope. Any business process that involves humans is prone to errors and hence are inevitable in any interface architecture. SAP PI/XI is a great tool to design a scalable and efficient interface architecture for an enterprise and it does come with many out-of-the box tools for error handling. However, these tools are very generic and hence may not meet specific customer requirements. This is especially true in case of inbound interfaces to ECC where business data is posted to the application. In almost all cases, there is a need to provide tools for the business user and end user community to react to errors when they happen and perform data level corrections before posting successfully.

The problem with out of the box tools is that it requires some understanding of how the tool works and is a challenge for the end user community to adopt the same. A good example is SXI_MONITOR which is a great tool for error handling and monitoring but its effectiveness stops with technical folks. Because of this, many times, the business user requires the technical folks to help in data manipulation which is an issue from auditing and controls perspective. So, there is a need for an interface architecture that is rugged enough to support complex interfaces but flexible enough to support error handling requirements.

In this blog series, I will share some of my experience in building custom tools for interfaces using ABAP proxies. These tools provide a easy to use interface for end-users to correct the errors and a generic framework for achieving the same. The generic framework uses dynamic programming (RTTS) supported by ABAP stack to provide a modularized, easy to use classes and modules that reduces development effort, maintenance and total cost of ownership.

Before we deep-dive in to the solution, here is a process flow of an interface that is built using an ABAP proxy.

abap proxy framework


One of the biggest advantage of ABAP proxy is that it can deal with huge volumes of data. Moreover, for performance reasons and controls reporting requirements, it is required to bundle many LUWs in one single message and proxies are an ideal choice.

However, as you can see, the main disadvantage of this design pattern is that there is no way to change the data in the payload. Now, I do understand that it is not the best business practice to alter the data in the target system. Data discipline, demands any corrections to be made in the source and then replicated to the target so that both source and target are in synch. But we know this not always practical, especially when you consider interfaces with external parties where correcting the data at source may take days if not weeks. Also, many times errors are transient in nature; like for e.g., material number is locked or wrong customizing. In such cases, we need a way to reprocess only specific LUWs that are in error instead of reprocessing the whole message.

On the other hand, IDOCs have been traditionally used for batch based interfaces and have proven to be a very stable architecture. It supports parallelization and has out of the box tools like BD87 for error handling. However, many standard IDOCs are not designed for multiple LUWs in a single message and hence don’t support batch level control reporting.

So, we see both Proxies and IDOCs have their pros and cons but interestingly some of the cons of proxy framework are pros of the IDOC framework and vice-versa. So, it is logical to provide a way of coupling both technologies to leverage the best of both worlds.

Here is process flow for the combined framework :-

ABAP Proxy and IDOC combined approach

In this combined approach pattern, we can post as many LUWs as in parallel using aRFC and when and only when there are errors in a particular LUW, we create an IDOC. This way, all the errors are staged as IDOCs and gives the end user an opportunity to view and fix the errors at a later point. We also use alert framework to raise error alerts and spools to write control reports.

To achieve this solution of combined approach, we use out-of-the box BAPI-ALE interface to generate IDOC definitions for BAPIs (if one doesn’t exist already) and then a custom utility class is used that leverages RTTS to dynamically create IDOC data based on the input signatures of the BAPI function module. By using these techniques, we greatly reduce the development effort where as provide a uniform approach for error handling and monitoring.

 Here is the key components of the solution :-

Solution design combined approach

As depicted above, not only we are able to dynamically create IDOCs for LUWs in error but we are also able to write a control report for the entire message that gives an overall picture of what happened in a particular interface run.

In the next parts of this blog series, I will cover the following topics

  1. Error handling framework for ABAP proxies – Part 2.
  2. Code snippets (and fully downloadable code) for creating a dynamic IDOC error handling tool (a better alternative to BD87) using ABAP WebDynpro
  3. A different, fully custom framework for error handling by using XML data and transformations. This will be interesting for folks who want to stay away from IDOC approach but still want to develop a custom tool for data manipulation. This tool is in WIP (work in progress) and will have features to suite the WS-RM as well.

Finally, thanks for taking sometime to read this blog. I had an opportunity to present this framework in SAP TechEd 08 – Las Vegas and was well received by the audience, hence this blog series.

You must be Logged on to comment or reply to a post.
  • Very good blog..

    Till now we were just sending the email from ecc to report error and than recreating the new file with only error records. But this process includes manual creation of the file and sometimes created lots of problem.

    We are also thinking abt error_table to store that data for later fix. But your Idoc approach look very robust.

    I am waiting for your next blog for code 🙂

    Thanks & Regards,
    Dijesh Tanna.

  • Hi Krishna Kumar,
    Very Good Blog for Error Handling in ABAP Proxies.
    Still we don't have any Blog Error Handling in each Adapter Level in PI 7.0. If you have any idea about these please let me know? Waiting for your next blog. Keep blogging...

    Thanks & Regards
    Venkat Rao .G
    Wipro Ltd., Hyd.

  • Hello ,
    Wanted a helo in the same scenerio,
    If i am processing a inbound proxy , in a provider class method i am posting data using bapi and if the bapi fails i raise a cx_ai_Application_fault who will handle this exception ? My Queue stucks up if i just raise it...I feel that provider class should what is your views,