Hello Everyone,
Introduction
While learning SAP Integration Suite, I wanted to build a real‑world scenario instead of simple message mapping examples. During this process, I explored how external APIs can be integrated into CPI, and currency conversion felt like a practical and finance‑relevant use case.
SAP Integration Suite provides the perfect middleware capability to fetch exchange rates from external APIs, perform calculations, and return results in a clean, readable format.
In this blog, I have designed an end‑to‑end Currency Conversion I-Flow that:
✔ Accepts JSON data from a source system
✔ Calls an external exchange rate API
✔ Converts the currency
✔ Formats the response beautifully (HTML table)
✔ Delivers the final output via HTTPS/Mail
Overall Architecture with I-Flow Design
Below is the architecture I have used in this integration scenario:
Main Flow Steps
- HTTPS Sender – Receive JSON input
- JSON to XML Converter
- Content Modifier – Extract fields
- Request‑Reply – Call External Exchange RateAPI
- Groovy Script – Perform conversion & prepare HTML
- Mail Adapter – Send result email
- Exception Subprocess – Error output.
How I Designed the I-Flow
I designed the I-Flow using the following steps:
HTTP Sender Adapter
I exposed the I-Flow as an HTTP endpoint where the user can pass source currency, target currency, and amount as parameters.Content Modifier
I used a Content Modifier to prepare request parameters and headers required by the RapidAPI currency conversion service.Request-Reply (HTTP Receiver)
The external API call was configured directly in the HTTP receiver adapter. This step helped me understand how authentication headers and query parameters work in CPI.Groovy Script – Response Processing
I wrote a Groovy script to parse the JSON response and extract:- Source currency
- Target currency
- Amount
- Converted value Instead of returning plain JSON, I converted the output into a simple HTML table, which makes the response more readable when tested via browser or Postman.
Exception Subprocess
While testing, I encountered HTTP 500 and 429 errors. To handle this, I implemented an Exception Subprocess that captures:- Error message
- HTTP response code
- MPL ID
This helped me clearly understand the importance of structured error handling in CPI.
Content Modifier Property
Initially, I tried passing query parameters directly, but it caused confusion during testing. Using a Content Modifier gave me better visibility and control over headers, especially while debugging RapidAPI authentication issues.
Groovy Script of conversion Logic and HTML Beautification
This script is responsible for:
- Reading the API response
- Extracting the exchange rate
- Reading the input currencies
- Calculating the converted amount
- Passing the result to the next step
This script prepares a beautiful HTML table for the final output. This improves readability when the response is sent to Postman, email, or UI.
Test the Flow Using Postman
I have used Postman to trigger the HTTPS endpoint.
This output will also trigger through the mail which I have mentioned in mail adapter.
Working of Exception Subprocess for Errors (Negative Tests)
Exception subprocess must contain:
- Exception Start Event
- Groovy Script – Prepare HTML Error Message
- End Message
The Exception Subprocess is triggered automatically by CPI whenever the I-Flow encounters an error.
Its job is to:
- Capture the error
- Identify the reason
- Classify the error
- Convert it into a readable HTML format
- Return it to the end user (Postman / Email)
This receives a clean, well‑formatted message instead of a raw technical stack trace.
My Personal Experience and Learnings
While implementing this integration scenario in SAP Integration Suite, I encountered several real‑time challenges that helped me understand the platform more deeply.
One of the key learnings for me was how important proper exception handling is in CPI. Initially, I focused only on the happy path, but during testing with Postman, I started facing HTTP 500 and XPath errors. Designing a reusable Exception Subprocess helped me standardize error responses and made the I-Flow much more robust.
This blog was written with the assistance of generative AI tools for language refinement. The integration design, implementation steps, testing, and learnings are based on my personal hands‑on experience.
Conclusion
This end‑to‑end scenario demonstrates how SAP Integration Suite can integrate external APIs, enrich responses, perform computations, and return a polished output.
It is a perfect demonstration of:
- Integration patterns
- Error handling
- Groovy scripting
- API integration
- Output formatting
You can extend this scenario to:
- Multi-currency batch conversions
- ERP finance integration
- UI5 front-end
- Microservices
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.