Using useOneAsMany function in Message Mapping if subtree is optional

Hi,
I am trying to develop a message mapping for the following case:
In the source message, there is a value "Value1" which is on the same level as a subtree "Struct2" which can occur 0..unbound times
In the target message the value "Value1" has to be part of that subtree, so it has to be copied for each occurence of "Struct2" in the source message
For the case that the subtree has cardinality 1..n there are some examples on the web, e.g. useOneAsMany (SAP-Bibliothek - Partner Connectivity Kit). But that does not fit my case. The subtree in the source message is optional here.
See a screenshot of the message mapping and my solution for the mapping of "Value1" below:
All other values are mapped 1:1.
Sadly, this solution does not work when "Struct2" has cardinality 0..unbound, for 1..unbound it works perfectly. Here is my example:
When I try the mapping, I get the following error message:
That is true. The first queue of the useOneAsMany function has more values than the second. But I don't know how I can fix it, so that it works for my example. Can anyone give me a hint please?
Setup is AEX 7.31.

Hi Stefan,
You can use this mapping.
And for Struct2-Value1
Result:
Hope this helps,
Mark

Similar Messages

  • How to use node functions in Message mapping !!

    Hi  Gurus,
    I have got one issue in message mapping, please can any one put some ideas on this !!
    Source Structure
    <Group_ZA>  0..unbound
         <D02_ZA>           0.. unbound
             ZA_01             0..1   - QA
             ZA_02             0..1      20
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1     QD
             ZA_02             0..1     40
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
          iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
         <D02_ZA>          
             ZA_01             0..1     QA
             ZA_02             0..1      20
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1     QD
             ZA_02             0..1     40
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
    iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    <D02_ZA>          
             ZA_01             0..1     QA
             ZA_02             0..1      20
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1     QD
             ZA_02             0..1     40
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QN
             ZA_02             0..1     12
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
         <D02_ZA>          
             ZA_01             0..1    QP
             ZA_02             0..1    60
             ZA_03             0..1
             ZA_04             0..1
         </D02_ZA>
    </Group_ZA>
    Target Structure
    ProductActivityNotification                                                       0..unbound
                          ProductActivity                                                             1..1
                                        Item                                                                 1..unbound
                                              Inventory                                                   0..1
                                                     UnrestrictedUseQuantity                    0..1
    The Group_ZA comes 'n' number of times and D02_ZA comes sometimes 5 times and sometimes 6 times etc.,
    ZA_01 field can come with 5 to 6 different values like 'QA','QD','QN' etc., sometimes ZA_01 comes only 3 times QA,QD,QN.
    if ZA_01 = 'QA' then only  we need to pass   ZA_02 value on to ''UnrestictedUseQuantity'' (target side),
    I mapped the fields, the vlaue ZA_02  passing properly on to 'UnrestictedUseQuantity' when D02_ZA comes 5 or 6 times, all the times 'QA'  value comes into ZA_01 field. In case if QA value missed or doesn't come from source, the Target side ' 'UnrestictedUseQuantity' field last value comes into last but one.
    Ex: QA value is in 3 times, but I have 4 source message on top. values comes into target side like
    20
    20
    20
    suppose to come like
    20
    20
    -- (Space)
    20
    Please required your valuable inputs in bit urget !!
    how to map field level please?
    Many Thanks in Advance
    Kind Regards
    San

    Petre:
    If you want to use standard functions then you try this:
    If-->currentdate -OR- Constant(01.02)
    currentdate -OR- Constant(02.02)   --> OR -->
    currentdate -OR- Constant(03.02)
    Then give some output
    Else give some output
    So give the output for the first two conditions to another OR and the result of the third to the same OR. So whenever the condition is true in any of the condition you will get the THEN value else you will get the ELSE value.
    ---Satish

  • How to use or function in Message Mapping?

    Hi! I was wondering if anyone can show me how to use the or function.
    Im trying to match the current date to three possible values so i need three or functions.
    EG. if ( currentDate == 01.02  || currentDate = 02.02  || currentDate = 03.02 ) {
              do something;

    Petre:
    If you want to use standard functions then you try this:
    If-->currentdate -OR- Constant(01.02)
    currentdate -OR- Constant(02.02)   --> OR -->
    currentdate -OR- Constant(03.02)
    Then give some output
    Else give some output
    So give the output for the first two conditions to another OR and the result of the third to the same OR. So whenever the condition is true in any of the condition you will get the THEN value else you will get the ELSE value.
    ---Satish

  • How to use functions in Message Mapping

    Hi All,
           I am new to SAP XI. I don't know how to use functions in message mapping.     Can any body tell me how to use IF condition in message mapping.
         Please provide me a good link where I can get the details how to use those functions.
    Thanks,
    Srinivas.

    HI Srinivas
    Please take a look at these links,
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    /people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
    /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
    This will help you
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/190eb190-0201-0010-0ab3-e69f70b6c257
    http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/a8/bfc6373c8fea43bdb3541535bcbd43/frameset.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/8a57d190-0201-0010-9e87-d8f327e1dba7
    This will give you a detailed Idea about Context
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db95f835c111d1829f0000e829fbfe/frameset.htm
    This will give more explanation on Queue
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/51a39490-0201-0010-5b9f-ae21e8b78195
    For understanding node functions this blog will help you
    /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
    Not sure you can find a collection of all...
    Cheers..
    Vasu
    <i>** REward Points if found useful **</i>

  • Message mapping - Duplicate subtree

    Hi Experts,
    I am working on 7.0 server.
    In the existing message mapping I found that target nodes are duplicated.
    For example
    /ns0:FiletoFile_ib_mt/Record/Emp[1]
    /ns0:FiletoFile_ib_mt/Record/Emp
    And the order for the node in the target message structure is same as above.
    And in the output, the order is reversed as below
    /ns0:FiletoFile_ib_mt/Record/Emp
    /ns0:FiletoFile_ib_mt/Record/Emp[1]
    But when am duplicating one more node in the existsing mapping the order is
    /ns0:FiletoFile_ib_mt/Record/Emp[2]
    /ns0:FiletoFile_ib_mt/Record/Emp[1]
    /ns0:FiletoFile_ib_mt/Record/Emp
    And now the output is
    /ns0:FiletoFile_ib_mt/Record/Emp[2]
    /ns0:FiletoFile_ib_mt/Record/Emp[1]
    /ns0:FiletoFile_ib_mt/Record/Emp
    But I need the output as
    /ns0:FiletoFile_ib_mt/Record/Emp
    /ns0:FiletoFile_ib_mt/Record/Emp[1]
    /ns0:FiletoFile_ib_mt/Record/Emp[2]
    Please let me know if you have faced similar issue.
    If am creating a new message mapping and duplicating the subtrees the order is given below
    /ns0:FiletoFile_ib_mt/Record/Emp
    /ns0:FiletoFile_ib_mt/Record/Emp[1]
    Why in the existing mapping duplicate subtree is going in the top order and for new message mapping duplicate subtree is going in the bottom. Please advice
    Thanks
    Suma S

    Hi Lucas
    I checked this sap note but I used PI 7.0.
    This happens from 7.10 onwards and this is primarily due to the reason that the occurence of the duplicated node was not remembered when the mapping program gets executed. So, the mapping program was expecting data from the payload for the duplicated node and hence the error

  • Copy value function in message mapping?

    can someone help me understand copy value function in message mapping???

    Hi,
    Here's a good example providen yesterday by Mark in a thread.
    [Re: different contexts to different targets]
    And here's SAP help: [http://help.sap.com/saphelp_nwpi71/helpdata/EN/26/d22366565be0449d7b3cc26b1bab10/content.htm]
    Then play...
    Mickael

  • Count-Function in Message Mapping

    Hey, trying to map following structures:
    message
    -m1
    --m11
    -m2
    --m22
    -m3
    --m33
    to
    message
    -m1
    --m11
    -m2
    --m22
    -m3
    --m33
    -f1
    --countItems
    The nodes m1,m2 and m3 can appear 1..unbounded. In target structure I would
    like to have the numbers of all nodes (m1,m2,m3).
    For example: In this source structure m1,m2,m3 appear only one time. In the
    field countItems I would like to have the number 3.
    I tried the count function, but it could only count the structure where I used it (in
    this case: f1).
    How can I count the above-mentioned nodes?
    thanks
    chris

    Hey,
    thanks for your answers.
    But I still couldn't understand how to do this. I open the message mapping for field f1, but the count function could only be set on an target-element, so where to set the counters for m1,m2,m3? Do I have to insert extra fields under m1..m3?
    If I do the counter would increment with every node, so if I have two times m1, in second tree of m1 a two will be insert. If I use the add function, only for these two tree the result would be three!
    @Gangisetty Vijaya Bhaskarudu
    Is this just one UDF? From where he knows, which nodes he have to count, if I have more than m1..m3, but only want to count this three?
    @ sasitharan
    same problem as mentioned above:
    this doesn't work:
    m1--count---\
    I can't use m1 as input for count! Or do I have a wrong count function?
    <b>....au damm, answered my own question. Of course. I use COUNTER and you use
    COUNT!!!!!!!!!!!! I will try this with COUNT!!</b>
    thanks
    chris

  • How can I use loop in graphical message mapping

    The source input XML is like:
    <bookstore>
      <book>
           <item1>xxx</item1>
           <item2>yyy</item2>
      </book>
      <book>
            <item1>zzz</item1>
           <item2>www</item2> 
    </book>
    </bookstore>
    I want to create an output XML like
    <output>
       <item>
            <item1>xxx</item1>
             <item2>yyy</item2>
        </item>
       <item>
            <item1>xxx</item1>
             <item2>www</item2>
        </item>
       <item>
            <item1>zzz</item1>
             <item2>www</item2>
        </item>
       <item>
            <item1>xxx</item1>
             <item2>yyy</item2>
        </item>
    </output>
    That means I want to do permutation and combination for all <item1> <item2> under <book>.
    Of course I can write a customer function to do it, but I want to basically use the buildin functions to do the graphical message mapping for this.
    Any idea?  thank you.

    well, I'm not very clear of those 2 English words
    What I want is to list all possible combination of item1 and item2 (and in fact, we have item3, item4, ....etc).
    example
    input: 
    <item>
              <item1> 111 </item1>
              <item2> 222 </item2>
              <item3> 333 </item3>
    </item>
    <item>
              <item1> aaa </item1>
              <item2> bbb </item2>
              <item3> ccc </item3>
    </item>
    I want to get
    <item><Item1>111>/item1> <item2>222</item2> <item3>333</item3> </item>
    <item><Item1>111>/item1> <item2>222</item2> <item3>ccc</item3> </item>
    <item><Item1>111>/item1> <item2>bbb</item2> <item3>333</item3> </item>
    <item><Item1>111>/item1> <item2>bbb</item2> <item3>ccc</item3> </item>
    <item><Item1>aaa>/item1> <item2>222</item2> <item3>333</item3> </item>
    <item><Item1>aaa>/item1> <item2>222</item2> <item3>ccc</item3> </item>
    <item><Item1>aaa>/item1> <item2>bbb</item2> <item3>333</item3> </item>
    <item><Item1>aaa>/item1> <item2>bbb</item2> <item3>ccc</item3> </item>

  • How to use analytical functions inside a mapping

    Hello everybody. Here Isend you a trick that we are using for two years.
    If you want to use a function (for instance :ROW_NUMBER() OVER (PARTITION BY ... ORDER BY ...)) inside a mapping you must create an expression with in the INGRP1 the fields you are going to use in the window function and in the OUTGRP1 the function you want. Create an Out -attribute with the expressión and link it to a distinct operator (using a "distinct" you encapsulte the sql and you will be able to use the function inside a filter - in the where clause.). The distinct can eliminate some register (depends on the function). If you validate the expression an error will appear (don't worry about that, the mapping will be ok).
    But there is a limitation, you will not be able tou sum over, min over, max over (it detect that they are aggregator functions). Other limitation: the debugger doesn't run with this kind of functions.
    Please publish this information on "The Warehouse Builder Utility Exchange". Mi email is [email protected] (if you need more information)

    It is possible to add SUM, MIN, MAX functions also to OWB releases prior to Paris - You have to put them in double quotes - write "MIN" "MAX" "SUM" etc. The rest of the rules (adding cut-off operator after the expression - as DISTINCT, or UNION ALL) is analogical to with ROW_NUMBER()
    That means You can create mapping with following functionality:
    SELECT
    sum (salary) over (partition by DEPARTMENT) department_salary,
    salary,
    employee_id,
    employee_name
    FROM employees_salaries
    writing it this way in OWB:
    SELECT
    "SUM" (salary) over (partition by DEPARTMENT) department_salary,
    salary,
    employee_id,
    employee_name
    FROM employees_salaries
    Regards,
    Martin

  • Use exported parameter from message mapping (via UDF) in next mapping prog

    Is there any chance to assign an exported parameter from one message mapping to another mapping program within an operation mapping?

    Hi,
    Try using  dynamic configuration
    1. Set value in message mapping and
    2. Get value in java mapping
    Refer this link http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Regards
    Suraj

  • How to use mathematical functions in XSL mapping

    Hi,
    I am using Jdeveloper 10.1.3.3. I need to insert mathematical functions like "multiply,divide,power" etc in my mapping. But in the XSL i am getting all string functions and very few math functions for number.
    I am newbie in Jdev. Please if anyone can share how this can be done.
    Thanks

    Hi,
    The RfcAdapter trys to find a Sender Agreement for this RFC call but the lookup failes. The values used for this lookup are:
    Sender Party/Sender Service: The values from Party and Service belonging to the sender channel.
    Sender Interface: The name of the RFC function module.
    Sender Namespace: The fix RFC namespace urn:sap-com:document:sap:rfc:functions
    Receiver Party/Receiver Service: These fields are empty. This will match the wildcard
    Regards,
    Suryanarayana

  • XSLT using Java function from graphical mapping (RFClookup)

    Hi,
    I was wondering if it is possible to use the standard Java functions of the graphical mapping (RFCLookup, Datetrans, ...) or from my own UDF inside an xslt mapping. Does anyone have every tried this or is an example available ?
    Regards Bernd

    Hi Bernd,
    here you can find an example how to use RFC lookup from an XSLT Mapping:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14?quicklink=index&overridelayout=true
    Is this what you're looking for?
    Regards,
    Gábor

  • Node functions in Message Mapping

    Hi,
    Could someone help me with some good exercises for node functions such as splitbyvalue, collapsecontents, removecontexts.
    I am a newbie to these functions and have absolutely no idea on how to use them. Would appreciate if someone could give very detailed examples to these functions in a step by step manner, so that I can create them just by following your instructions.
    Any links to video presentations are welcome too.
    Cheers,
    S

    Hi ,
    For a fresher, the informationa and examples given in the help.com would be more helpful and it will help you in building string fundamentals. Once your basics and funcdamentals concepts becomes strong then you can go for more complex exmples. Here is help.sap link where you can leran Node functions of MM of PI.
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
    Thanks,
    RK

  • New line in concat function in message mapping

    Did any1 succeded adding 2 xml elemnts with LF/CR ( new line ) between them?
    so when I use content conversion to txt file it will put new line between this 2 elements?
    I tried the following delimiters
    '0x0D''0x0A'
    'nl'
    ''0x0D''''0x0A''
    nothing worked
    thx
    Shai

    Shai,
    Here is a simple udf for adding a new line between two fields. Similarly you can extend it.
    Create a "Value" UDF as name "input" and add two arguments 'a' and 'b'.
    Add this code:
    String lines;
    lines = "";
    lines = lines.concat(a + '\n' + b + '\n' );
    return lines;
    Also while testing in test tab if you dont see the new line in the ouptut then view the source of the output. There you can see the new line.
    Regards,
    ---Satish

  • Defing user defined function in message mapping

    hi experts of xi.
    i want to create UDF for counting no of records in body and checking with trailer countinfo and adding all contract account amounts in file body and checking with trailer sum.
    if these 2 comparings r not matched then we have to set flag field 'N' else we have to set as Y'.
    waiting for ur answer.
    regards.
    seeta ram.

    Hi,
    pretty easy if you want to count number of lines (records)
    two inputs (trailer and line segment)
    and you can just compare it inside
    then you can just return Y or N
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

Maybe you are looking for