Various multi-mappings and Optimizing their Implementation in Integration Processes (BPM) in XI.
Multi-Mapping plays a vital role in splitting a single input file to many and collecting messages from one or more files having same or different Message Types. Multi-Mapping can be done in many ways and this weblog illustrates about various types of multi mappings and optimizing their implementation in BPM.
Let me list out all possible types of multi mappings in any environment.
- 1: N multi mapping
- N: 1 multi mapping
- M: N multi mapping
Coming to multi mapping in a XI perspective, multi mapping can be done at two levels.
- Message Type level: Its a mapping between source message to target message of different messages types and vice versa.
- Message Instance Level: Its a mapping between messages instances of same message type having occurrence more than zero. One input message is mapped to output message of same message type N times. In XI, we can specify the number of occurrences i.e. 0 to 1, 1, 0 to unbounded. For setting minimum and maximum occurrences refer SAP HELP. Note. In Message Instance Level, occurrence of message instance is 0 to unbounded.
In a situation where you need more than single occurrences of an output message of one message type. For example, instances where we need the output message twice. We can do this the same way as in 1:2 multi mapping at message type level multi-mapping. For our easy understanding lets take a case where we need to handle 10 output message of one message type. Walking on the same lines makes the process onerous. Hence we can go for message instance level multi-mapping to serve our purpose in one shot. The main advantage of message instance level multi-mapping is it provides flexibility in dynamic processing.
Hence, we have 6 types of multi mapping in XI. Let’s take a look at 1: N multi mapping.
1: N multi mapping
Message Type level :
Each message involved in mapping hold only one message instance.
This is illustrated in the blog Illustration of Multi-Mapping and Message Split using BPM in SAP Exchange Infrastructure
Message Instance Level:
Let us deal the topic under the following heads
Define Data type, message type for input, interface count and output respectively. You will be clear what the fields for all data types are.
Message mapping :
Lets see 1: N message mapping at Message Instance level. Here we are specifying occurrence of source messages 1 and of target message as o to unbounded.
So our message of name Piyush_msg_out_3 can occur indefinite times.
Just check out the design part of this mapping.
We are controlling occurrence of Output Piyush_msg_out_3 by mapping it with element2 with message context.
We are using UseOneAsMany under category node functions (SP14). It has three inputs ;
- Element which is going to be used for multiple times. In our case it is Element1 with message context.
- The element which is going to define how many times it will be replicated. Important thing, context should be same.
- Same as second input but with its own context in our case it is Element2.
Now we will see test part: Here for simplicity I have taken output message occurs twice.
Here our target message 1 is holding two instance of Piyush_msg_out_3.
Do the interface mapping with abstract interfaces as we need to use this interface mapping into BPM.
Note: make sure that occurrence of interfaces and messages are perfectly matched.
Now we have got desired number of interfaces. Now we will proceed to design of Integration process at BPM.
Integration Process :
Sequence of steps :
- Receive Step: It receives the message in_msg1 of type Piyush_mi_ob_abs_1 and invokes the start process.
- Transformation: This transforms input message into two messages as shown in above mapping (fig I.e.). Here we are holding output into multiline element out_msg1.
Now we have output interfaces in multiline element. For sending output interfaces to adapter engine, we can proceed in three ways, using block parforeach, block for each or loop.
For our case, we dont need further processing. Block parforeach is used in case where we need further processing. Hence we have two ways remaining. We can process either with the help of block foreach or loop. For optimal use of resources, we should go ahead with loop as explained in this SAP HELP
Now review what we need for using loop. This means we need an index which is used to iterate through the loop. As our output message doesnt contain any element which indicated total no of interfaces generated. So we need an interface which is holding an interface count.
Its not preferable to go for many transformations in Integration process. Therefore we will have two output messages, one holding interface count and the other holding desired output message instances..
Here we are going to use 1: N message mapping at message level and Message Instance level too.
Our message mapping will be as follows
In this way, we will have a total count of how many interfaces are generated.
Our final interface mapping would be:
- Container operation 1: In this step, we are trying to initialize the variable index to zero.
- Loop: Check whether index has reached up to count or not?
- Container operation2: It increments index by 1.
- Send step: It sends the current line of the multiline interface element out_msg1 whose index is given by the container variable index i.e out_msg1[index].
- Go to step 4
Our integration process will be as
Design part of scenario is over.
We will have 2 receiver determinations(AE to PE and PE to AE), 2 interface determinations, 1 sender agreement, and 1 receiver agreement.
And thats it just activate the change list and give the input file at location specified in sender agreement.
You can monitor the process at Xml message Adapter Engine (AE) to Process Engine (PE) and rest N are PE to AE.
You can see workflow log double click PE and you will see process listed.
Just find list with technical details tab and get workflow log.
I hope this blog has given a clear understanding of the various multi-mappings that can be done in BPM and optimizing 1: N multi-mapping. My next blog will give implementation for N: 1 and M: N multimapping