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!
cancel
Showing results for 
Search instead for 
Did you mean: 
irvinrufus
Explorer
Introduction

CPI is a wonderful technology for B2B scenarios helping us connecting different systems, organize and transform data. As with connecting different systems, we may also at times need to process exceptions when things don't follow the way we expect them to.

This blog provides a beginner level insight into handling an exception in CPI.

CPI has the capability to handle exceptions. However, the way the exceptions are handled may be a little different than a beginner might expect. It was definitely different than what I expected 🙂

As a traditional ABAP developer, I was expecting to catch the exception and route the control to the subsequent steps in the main iFlow. But, exception handling in CPI by design does NOT return to the main flow after an exception is raised.

For example, in the below flow, I'm expecting an exception at "Get gvCounter" step. But once the control proceeds to Exception process, the control does not return to the main integration flow  to process the rest of the steps.


Exception Handling Issue


Solution option

How could the exception sub-process be routed back to the main flow?

One solution option is to group the subsequent processes in the main flow into a sub process and invoke the sub process within the Exception flow.

By granularizing the main process into sub processes, we can deviate the exception flow to process the remaining steps in the Integration flow.

Overview of the steps

  1. Define the rest of the process flow as a local integration process as "remainingFlow"

  2. invoke the "remainingFlow" from the exception handling flow

  3. Add another step to invoke "remainingFlow" after the step that throws the exception. This is because we need the "remainingFlow" to be processed even when there is no exception.


Step 01 - defining the "remainingFlow".


Step 02 - Define an exception process and invoke "remainingFlow" from the exception process.

In my example, I'm expecting an exception at the Get persist variable step "Get gvCounter". So, I'm defining an exception handling process to handle the error when the variable gvCounter is not persisted before.


Define Exception Handling - Invoke remainingFlow


Step 03 - I also need to make sure that the "reminingFlow" is processed even when there is no exceptions.

So, I'm invoking the "reminingFlow" in my main flow as well.


Invoke remainingFlow from Main flow


After deploying, we can see the remainingFlow is invoked irrespective of whether there is an error or not.

Concluding Thought

The solution discussed here could be one among the many options. Any experienced developers are welcome to suggest any other methods you know to process the rest of the Integration steps after an exception is raised.

Also feel free to comment any SAP blogs or learning paths that would help learning Integration suite.

Here are some helpful links that I follow to learn Integration Suite:

SAP Integration Suite

Developing with SAP Integration Suite

SAP Integration Suite - Certification Path
5 Comments
rob_a_wilson
Discoverer
0 Kudos
Thanks irvin.rufus - very informative. Do you have any suggestions on how to continue from an Exception SubProcess when it's calling process is called from a splitter?

For example - if a splitter causes a process to be called 5 times, but fails on the 3rd run (for any reason - especially unexpected ones), how can the iFlow be configured to continue for runs 4 and 5?

Run 1 - normal process success and continue

Run 2 - normal process success and continue

Run 3 - normal process fail, log error/raise alert and continue

Run 4 - normal process success and continue

Run 5 - normal process success and continue

 

 
mittal-aman00
Explorer
0 Kudos
Hi Rob,

Please let me know if you had any success with this kind of requirement.

Thanks.
rob_a_wilson
Discoverer
0 Kudos
Not yet - still working on it
nicholdavis
Newcomer
0 Kudos
Hi Rob,

 

Not sure if this will work, but worth a try.

Define the flow within the splitter in a process direct and handle exceptions there, also uncheck stop on exceptions in splitter

 

Regards

Nic
rameez_khan
Active Participant
0 Kudos
For catching exception sub process after splitter, below works:

  1. Main IFLOW

  2. Call Splitter

  3. Request Reply -> Process Direct -> Call Second IFLOW

  4. Second IFLOW -> Handle Exception sub process and end message

  5. Returns to MAIN IFLOW

  6. GATHER


Thanks & Regards

Rameez Khan
Labels in this area