SAP CPI iFlow Template Generator
IntegrationNewGenerate SAP Cloud Platform Integration (CPI) iFlow configuration templates. Configure sender/receiver adapters, mappings, and groovy script stubs for common integration patterns.
iFlow Configuration
# iFlow Configuration: Order_To_S4HANA_Integration # Receive orders from external system and post to SAP S/4HANA [iflow] id=Order_To_S4HANA_Integration name=OrderToS4HANA description=Receive orders from external system and post to SAP S/4HANA version=1.0.0 [sender] participantName=ExternalSystem adapterType=HTTPS address=/http/order_to_s4hana_integration csrfProtection=true authentication=BasicAuthentication [receiver] participantName=S4HANA_PROD adapterType=S/4HANA systemName=S4HANA_PROD communicationArrangement=SAP_COM_XXXX authentication=OAuthClientCredentials [mapping] type=Groovy Script scriptFile=mapping.groovy methodName=processData [errorHandling] enabled=true escalateEvent=true logPayload=true [logging] enabled=true attachPayload=true logLevel=INFO
Groovy Mapping Script
import com.sap.gateway.ip.core.customdev.util.Message
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
/**
* iFlow: OrderToS4HANA
* Mapping script for ExternalSystem β S4HANA_PROD
*/
def Message processData(Message message) {
def body = message.getBody(String.class)
def headers = message.getHeaders()
// Log incoming message
def msgLog = messageLogFactory.getMessageLog(message)
if (msgLog) {
msgLog.addAttachmentAsString("Input", body, "application/json")
}
try {
// Parse input
def json = new JsonSlurper().parseText(body)
// TODO: Map source fields to target fields
def output = [
SalesOrderType: "OR",
// Add more field mappings here
]
message.setBody(JsonOutput.toJson(output))
message.setHeader("Content-Type", "application/json")
} catch (Exception e) {
message.setBody('{"error": "' + e.message + '"}')
throw e
}
return message
}Advertisement
Frequently Asked Questions
What is SAP CPI?
SAP Cloud Platform Integration (CPI), now part of SAP Integration Suite, is SAP's cloud-based middleware. It uses iFlows (Integration Flows) as the graphical design unit for defining integration scenarios between SAP and third-party systems.
What adapters does SAP CPI support?
CPI supports HTTPS, SOAP, OData, IDoc, SFTP, S3, HTTP, AS2, AMQP, Kafka, JMS, SuccessFactors, and many more. The generated template covers the most common adapter types with their typical configuration parameters.
How do I deploy a CPI iFlow?
After designing the iFlow in the Web UI or importing the generated configuration, deploy it via the Deploy button in the CPI Web IDE or via the CPI API (POST to /api/v1/IntegrationDesigntimeArtifacts). Monitor it in the Message Monitoring section.
Advertisement