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 Advisor Artifacts.
Import Script Collection.
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.
Choose Add → Script Collection.
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.
Choose Actions → Deploy.
Task 2: Make Script Collection Available in iFlow
Make Script Collection Available in iFlow.
Navigate back to your main iFlow PurchaseOrder and choose Edit to add the script collection to the integration flow.
Open the configuration view of the iFlow by double-clicking the Integration Process pool. Navigate to Resources → Add References → Script Collection.
Select the SC_PO script collection and choose OK.
Task 3: Catch Potential Exceptions Within the iFlow
Catch potential exceptions within the iFlow.
From the top menu, choose Process → Exception Subprocess.
Position the element anywhere within the Integration process pool.
Choose Transformation → Script → Groovy Scriptand place it within the Exception subprocess.
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.
In the Processing tab, choose the Select, then Referenced Resources. Choose the utils script and choose OK to proceed.
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.
Choose Error End Event from the Events menu.
Connect the elements.
Choose Save as Version → "1.0.1" to secure your progress.
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.