Skip to Content

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.

Introduction

Let me list out all possible types of multi mappings in any environment.

  1. 1: N multi mapping
  2. N: 1 multi mapping
  3. M: N multi mapping

Coming to multi mapping in a XI perspective, multi mapping can be done at two levels.

  • Message Type level: It’s a mapping between source message to target message of different messages types and vice versa.
  • Message Instance Level: It‘s 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 let’s 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

Design:

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 :

     Let’s 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.

image

So our message of name Piyush_msg_out_3 can occur indefinite times.

Just check out the design part of this mapping.

image

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 ;

  1. Element which is going to be used for multiple times. In our case it is Element1 with message context.
  2. The element which is going to define how many times it will be replicated. Important thing, context should be same.
  3. 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.

image

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.

image

Now we have got desired number of interfaces. Now we will proceed to design of Integration process at BPM.

Integration Process :

Sequence of steps :
  1. Receive Step: It receives the message in_msg1 of type Piyush_mi_ob_abs_1 and invokes the start process.
  2. 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”.
  3. 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 don’t 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 doesn’t contain any element which indicated total no of interfaces generated. So we need an interface which is holding an interface count.

    It’s 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

    image

    In this way, we will have a total count of how many interfaces are generated.

    Our final interface mapping would be:

    image

  4. Container operation 1: In this step, we are trying to initialize the variable index to zero.
  5. Loop: Check whether index has reached up to count or not?
  6. Container operation2: It increments index by 1.
  7. 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].

image

  1. Go to step 4

Our integration process will be as

image

Design part of scenario is over.

Configuration :

We will have 2 receiver determinations(AE to PE and PE to AE), 2 interface determinations, 1 sender agreement, and 1 receiver agreement.

And that’s it just activate the change list and give the input file at location specified in sender agreement.

Monitoring :

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

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Meena Rane
    Hi Piyush..
    That was a very helpful blog..
    I am new to BPM and wanted to try 1:N mapping..
    I followed the steps and created a similar scenario.
    But in my output folder i just get one file..the first one specified in input message.
    Although in IR count gets populated correctly and mapping works fine, i dont understand why isnt the process going in loop. 
    Can you please help ? anything i could have missed out ?
    It shows success in SXMB_MONI.
    But when i see the outbound channel it does not show the second container where the index gets incremented….

    Thanks,
    Meena

    (0) 
    1. Narendra Jain Post author
      Hi Meena,
      >>Although in IR count gets populated correctly and mapping works fine, i dont understand why isnt the process going in loop.

      You are gtting the one file, then it’s going into loop.

      There are two possibilities:
      1. index is not incrmentd in the loop.
      2. Loop condition satisfies for indx=1.

      In receiver file adapter, select “Add Time Stamp”

      So you will get all possible files.

      Chck the loop condition.

      It should be index != IR count.  Or reverse.

      Hope your scenario will work.

      Regards
      Piyush

      (0) 
    2. Senthilnathan Natarajan
      Hi,
        You might be getting this issue since you would have created the source XML file from the ‘Test’ tab of the mesage mapping or the interface mapping.

      This file would have the following two additional nodes
      1.Mesaages
      2.Message1

      But these nodes should not be a part of the source file as they are genearted to accomodate the unbounded occurrences of the target file.

      So,you will have to remove the tags corresponding to these two nodes from the b4 loading the source file.

      (0) 
  2. Mudit Mehra
    hi;

    good blog.i have a query .i have defined a container variable as integer simple type but am not able to see the index in the send step.

    my scenario is fetching data from ODS and giving multiple RFC calls depending on the rows fetched.
    i have defined the message mapping and interface mapping already with targets occurence 0—unbound.

    (0) 

Leave a Reply