With this blog, I’m closing my blog series about the Enterprise Integration Pattern on SAP Cloud Integration. If you like to find out more about the motivation and use cases for the Enterprise Integration Pattern blog series, start with the Enterprise Integration Patterns at SAP Cloud Integration: Scatter-Gather blog. Also, check out the Integration Flow Design Guidelines for SAP Cloud Integration blog referring to integration flow design guidelines and patterns for SAP Cloud Integration that SAP has recently published on the SAP Help Portal.
In the current blog, I would like to cover the Splitter pattern. You use a Splitter pattern if you need to split up a bulk or composite message into individual messages. In our example, we have an order with multiple items, so we split the order into individual messages each containing the data related to one item. Here, we need to ensure that the header information of the order is kept for each split message. You find example XML files before and after split here below the section Splitting a Single Order with Multiple Items.
In the following, we describe the pattern for both SAP Process Orchestration and SAP Cloud Integration.
Splitter on SAP Process Orchestration
On SAP Process Orchestration, we do have two options, either using Business Process Management (BPM) or implement the split with a message mapping.
An example of the first option via BPM is described in the Enterprise Patterns in Process Orchestration – Splitter blog. You may go for a BPM process if there are further message orchestration steps required.
In the following, I would like to stick to the message mapping option. Here, you find two examples in the Stateless Enterprise Integration Patterns on SAP Process Orchestration paper. In the Splitter chapter of the paper, two variants are described: a split depending on line items and a split depending on receivers. The first variant describes exactly our example here.
In the message mapping, the occurence of the source message type is set to 1, and for the target message type it’s unbound.
For each item within the source structure, a new message should be created. So, we map the item node to the PurchaseOrder node.
The order header information such as the order number should be added to each individual target message. So, this information needs to be replicated. This can be achieved by using the CopyValue standard message function.
The item node and all child nodes can be mapped one by one. For the item, we need to insert a context change to ensure that each message contains one item only. Here, we use the SplitByValue standard message function.
Splitter on SAP Cloud Integration
On SAP Cloud Integration, we do have several options depending on the use case. In the Splitter documentation on the SAP Help Portal we cover two use cases: Splitting a bulk order message into multiple orders and the use case described above, i.e., splitting a single order with multiple items.
For the first use case, we use an Iterating Splitter flow step. For a detailed description, check out the Variant with Iterating Splitter documentation on the SAP Help Portal.
For the second use case, we describe two options: either reusing the Message Mapping from above or using a General Splitter flow step.
The reuse of the message mapping is described in the Variant with Message Mapping documentation. Also, see how message mappings can be imported from an Enterprise Service Repository of SAP Process Orchestration here.
Let’s focus here on the Variant with General Splitter. As you can see, the model is quite simple. We only need a General Splitter flow step to split the order into individual messages based on the items. On the Processing tab of the General Splitter configuration, we select XPath as expression type, and maintain an xpath expression pointing to the location of the item node. The beauty of this option is that the General Splitter automatically duplicates the header information of the order for each individual message.
Further examples and configuration options of the splitter pattern are also described in the SAP Cloud Integration – Splitter blog from a colleague of mine.
On the SAP API Business Hub, you find the sample integration flow within the Integration Flow Design Guidelines – Enterprise Integration Patterns package. You can test the pattern on your SAP Cloud Integration tenant. It also runs on the cloud integration runtime of your SAP Process Orchestration 7.5 system.
With this remaining pattern, I have now covered all patterns that we have published so far. Enjoy reading also the rest of the blogs: