Developing with SAP Integration Suite

Handling of Errors

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Handle errors within an iFlow by extending it with an exception subprocess

Handle Errors: Exercise Overview

Scenario

In this exercise, you will learn, how to handle potential errors.

Task Flow

In this exercise, you will perform the step: 34 Error Handling, which consists of the following substeps:

  • Import a script collection.
  • Make the script collection available.
  • Catch exceptions.

Prerequisites

Prerequisites are:

Handle Errors

Exercise

Handle Errors

Start Exercise

Task 1: Import Script Collection

Scripts that should be available outside of a particular iFlow can be made accessible through a script collection. You have previously downloaded a zip file named "provided_integration_content" containing a script collection in the lesson "1.3 Set Up your Environment". The script you will use to log errors is part of this collection and has to be added to the CI package you are working with. For the required steps to obtain this file see exercise Generate and Consume SAP Integration Advisory Methodology Artifacts.

Steps

  1. Import Script Collection.

    1. Navigate back to your package via the Design icon in the left menu bar, choose your package, and choose its Artifacts tab. You will see the iFlows you are working with. Select Edit.

    2. Choose AddScript Collection.

    3. Choose Upload and locate your previously downloaded script collection zip file "SC_ACI.zip" in the "provided_integration_content" folder. Give it the Name SC_PO, optionally add a Description, and choose OK.

    4. Choose ActionsDeploy.

Task 2: Make Script Collection Available in iFlow

Steps

  1. Make Script Collection Available in iFlow.

    1. Navigate back to your main iFlow PurchaseOrder and choose Edit to add the script collection to the integration flow.

    2. Open the configuration view of the iFlow by double-clicking the Integration Process pool. Navigate to ResourcesAdd ReferencesScript Collection.

    3. Select the SC_PO script collection and choose OK.

Task 3: Catch Potential Exceptions Within the iFlow

Steps

  1. Catch potential exceptions within the iFlow.

    1. From the top menu, choose ProcessException Subprocess.

    2. Position the element anywhere within the Integration process pool.

    3. Choose TransformationScriptGroovy Scriptand place it within the Exception subprocess.

    4. In the Groovy Script configuration view, under General, change the Name to logException_groovy_script and add logException as Script Function in the Processing tab. When you look at the script in detail, you will also see other available functions.

    5. In the Processing tab, choose the Select, then Referenced Resources. Choose the utils script and choose OK to proceed.

    6. As of now, the exception process allows the iFlow to be 'falsely' marked as completed in the case of an error. This can be done intentionally. However, if you like to configure your integration flow so that the message status displayed in the message processing log is Failed (even in case an exception occurs during the processing sequence which has been handled successfully in an Exception subprocess), you can use an Error End Event. Select the End Message element that was automatically added when creating the exception subprocess and delete it.

    7. Choose Error End Event from the Events menu.

    8. Connect the elements.

    9. Choose Save as Version"1.0.1" to secure your progress.

Result

You have handled any potential exceptions during iFlow deployment with an exception subprocess without 'falsely' marking the iFlow as completed in case of an error occurrence.

Save progress to your learning plan by logging in or creating an account