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

Similar Messages

  • 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>

  • 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

  • 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

  • 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

  • Need help for Count function in XSLT Mapping

    Hi All,
    We have a requirement in our project,to do the xslt mapping from OAGIS 9.0 to EDI XML.In the EDI XML we have a SE tag whose value is the count of the no. of complex elements that will be generated in the EDIXML file( which is the target).
    Please do let me know if anybody has done this functionality in the xslt mapping.
    Thanks in Advance.
    Regards,
    Kaavya

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • 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>

  • 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

  • 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

  • Functions at Message Mapping - Concatenate with If

    Dear SAP Masters, please kindly help me to solve this case.
    Please guide me how to achieve this :
    Column1 = Sales Order number
    Column2 = Sales Order Item number
    Column3 = Sales Order Type
    Column4 =
    For each line, if Column3 start with "ZOR" then column 4 = concatenate Column 1 (SO No) with Column2 (SO Item No), else then Column4 = <blank>
    Please kindly give me an idea.
    Thanks,
    GJ

    Hi GJ,
    what about something like this:
    Let me know if it works.
    Regards!

  • Message Mapping (user-defined function)

    Hi all,
    Is there anyway to determine the XML message ID using an user-defined function in Message Mapping? When I go to SXI_MONITOR I see that all messages have an unique ID, but I'm having some difficulties to understand if there is any way to get that ID in a message mapping and pass it to a target structure? I see that it is possible to use constants like "Sender" and "Receiver", but I haven't found anything for the message ID.
    Can you please help me?
    Thanks in advance.
    Regards,
    Ricardo Inácio

    Try this code..
    Create an UDF and do not pass any arguments to it..
    java.util.Map map;
    // get runtime constant map
    map = container.getTransformationParameters();
    // get value of header field by using variable key
    String msgid = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
    return msgid;
    Now map this udf to your target field. Now test it....
    P.s. Since message id is run time property therefore in mapping test tab it will not work. Try it at runtime.
    Regards,
    Sarvesh

  • Functions in Graphical message mapping

    Hi All,
    I hve a scenario where i have to use various functions in Graphical mapping tool like lastindexof,  format number, etc etc . Can anyone has sample examples explainng the functionality of all the functions in message mapping tool. Atleast a few would be helpful..
    Thanks
    Michael

    Hi,
    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
    Regards,
    Bhavesh

  • Data lookup in R/3 database from message mapping

    Hi,
    I am trying to lookup R/3 database from Message mapping.
    Instead of creating Java class outside XI and then importing into Integration Repository, I have defined an advanced function in message mapping and trying to connect to R/3 using JCo API. But System is giving syntax errors as listed below:
    Check Result for Object CustomerDetailsMap Source code has syntax error:
    F:/usr/sap/C03/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapc1513850c14511d985d5001143eb68b9/source/com/sap/xi/tf/_CustomerDetailsMap_.java:58: illegal character: 160 Â Â Â Â Â Â Â Â // Change the logon information to your own system/user
    F:/usr/sap/C03/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapc1513850c14511d985d5001143eb68b9/source/com/sap/xi/tf/_CustomerDetailsMap_.java:60: illegal character: 160             "DEV18" ,    // userid
    Can somebody help in rectifying the problem?
    Thanks and Regards,
    Nitin.

    Hi,
    can u post the java code which u have used in mapping.
    There is a doc in XI-Articles. "How to Perform SAP Data Lookups Within XI Mappings" By Jerome Delune 16 October, 2003. Try looking at this article and do ur mapping.
    Hope this helps you.
    Cheers,
    Siva Maranani.

  • Exchanging data between interface mapping and message mapping possible?

    Hi,
    please have a look at my interface mapping:
    source message -
    >
    mapping programs
    1. Java mapping
    2. XSL mapping
    3. message mapping
    > target message
    in my scenario a Java Class (1) is called for the interface mapping. There, some information ist read from the xml structure. Next, a xslt mapping (2) takes place that strips some information. The remaining data is passed to the message mapping (3)
    The reason for this is that the source message consists of a xml message inside an xml message.
    I am looking for a way to access the informationen gained in step 1 (Java class) in the message mapping (step 3). I was hoping that the global container (used by user-defined function within message mapping) is accessible from the java mapping, but I could not find out how.
    Anybody with some ideas how to pass information from step 1 to step 3? I cannot put the Information in the xml that is passed to the message mapping, because the schema of the inner xml cannot be changed.
    Thanks very much, best regards,
    Wolfgang

    Hi Wolfgang!
    I have used the "Dynamic Configuration" section in the XI Message header for this issue. You could write something into the Dynamic Configuration Section in step 1 (Java-Mapping) and read it out again in steps 2 or 3. You could use a section for a adapter you are not using in your interface for the real receiver. So if you have a File-Receiver Adapter at the "end" you could use some section of the e.g. SOAP adapter not to interfere with your receiver-adapter when using Dynamic Configuration Settings there ...
    See also: http://help.sap.com/saphelp_nw04/helpdata/de/43/09b16006526e72e10000000a422035/content.htm
    or
    http://help.sap.com/saphelp_nw04/helpdata/de/43/0a7d1be4e622f3e10000000a1553f7/content.htm
    Best regards,
    Andi

Maybe you are looking for

  • Photoshop CS4 type tool and paint bucket

    I am teaching Photoshop CS4 to my students and have started having problems I've never encountered. Problem #1 - Type tool won't work. We can create a text box and type in it. Text does not show on the document but does show in the layers palette. I'

  • Only ints return from SQLite queries with calculations

    Howdy.  Hope I have the right forum for this question. I'm on a project using a SQLite database in Flex 4 and I'm using the following SQL query: SELECT max(totalScore) AS score,                max(longestStreak) AS streakLen,                max((corr

  • Why is Firefox 20 on my Windows 7 laptop not showing all my My Yahoo toolbar icons?

    I just downloaded Firefox 20 and it seems to have bugs. I noticed that my Yahoo toolbar is incomplete and is missing several icons. My computer uses Windows 7 64 bit.

  • Extend cutomer master data

    Dear All, what is the procedure to extend customer master data.i want to extend my customer master with distribution channel. Regards Ajit jaiswal

  • I've experience a concerning problem on Macintosh Mail

    CONCERNING PROBLEM #1 I have sent sensitive emails that were received by the intended recipient, but were also by an unintended recipient. It appears the unintended recipient intentionally made this happen in a pre-meditated manner by using receive C