In message Mapping field

hi,
i have the source structure like
<Header>  occurs 0..unbounded
     Lineitem 1 occurs 1..1
     Lineitem 2 occurs 1..1
     Lineitem 3 occurs 0..unbounded
         Lineitem 4 occurs 1..1
         Lineitem 5 occurs  1..1
Target sturcture
<header> occurs 0..unbounded
          Line item 1 occurs 0..1
          Line item 2 occurs 0..1
          Line item 3 occurs 0..1
          Line item 4 occurs 0..1
Now my doubt is Line item 4 is the grand total, if the segments repeats the grandtotal should come in the last occurence of the header. But it is coming in the first occurence of the header.
could you please help me in the regard.

<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_context xmlns:ns0="/http://Create">
- <Header>
  <Matno>001</Matno>
  <MatDesc />
- <item>
  <matno />
  <itemno>1</itemno>
  <matgrp />
  <price>3</price>
  </item>
- <item>
  <matno />
  <itemno>2</itemno>
  <matgrp />
  <price>4</price>
  03
  </item>
- <item>
  <matno />
  <itemno>3</itemno>
  <matgrp />
  <price>5</price>
  </item>
  </Header>
- <Header>
  <Matno>002</Matno>
  <MatDesc />
- <item>
  <matno />
  <itemno>01</itemno>
  <matgrp />
  <price>13</price>
  </item>
- <item>
  <matno />
  <itemno>02</itemno>
  <matgrp />
  <price>14</price>
  </item>
- <item>
  <matno />
  <itemno>03</itemno>
  <matgrp />
  <price>15</price>
  </item>
  </Header>
  </ns0:MT_context>
Target is
  <?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_context_tar xmlns:ns0="http://create">
- <Material_Details>
  <matno>001</matno>
  <item_details>123</item_details>
  <total>12</total>
  <grandtotal>54</grandtotal>
  </Material_Details>
- <Material_Details>
  <matno>002</matno>
  <item_details>010203</item_details>
  <total>42</total>
  </Material_Details>
  </ns0:MT_context_tar>
see now the grandtotal is coming in the first material details
but i need in the last material details of the occurence
cud u help me now??

Similar Messages

  • Message Mapping Field Name

    Hi!  I am trying to get the Field name of the XML element, when I am defining my own function.  Can someone please provide me some help!  Example:
    In the Graphical Editor, let's just say we drop the following fields:
    Source                                     Target
    City                 to                    City
    How can I grab the XML field name "City"?
    Thanks,
    Rob

    Hi Robert,
    In the Message Mapping, there is a button named 'Text Preview', just below the Tab names 'Design - Test - Messages'. If you click that, it displays the complete mapping in a text area. It conatins full paths of all mapped fields, similar to the XPath, which you can use in your function.
    If this helps you, please remember to award the points and close the post.
    Good luck,
    Bhanu

  • Password Sync Message Mapping

    Hello,
    I have installed and configured resources for IM 8 with patch 5 on linux with oracle repo.
    However I have run into my first problem that seems to require more heads than my own.
    When configuring JMS as a resource (i have already configured JMS queue 4.3 on my app server with con factory and queue) there is a Message Mapping field that I do not know what the contents should be.
    The (?) button shows the following for the field
    +Specify the custom code used to build a map of attributes [ right-hand side of schema map ] from an incoming JMS Message.+
    It can be a string of the format rule:name, where name is the name of a Rule. The rule is expected to return a map. The rule can access the raw JMS message via a variable reference to message.
    Also, it can be a string of the format java:classname, where classname is the classname of a custom Java class which implements the JMSMessageMapper interface in the com.waveset.adapter.jms package.
    Alternatively, it can be a string of the format attrparse:name, where name is the name of an AttrParse object in the IdM repository. This will treat the Message as a TextMessage, and convert the string to a map using the specified AttrParse object.
    I am thinking that the AttrParse would be the best way to go, any thoughts>? example? or guidence for creating this custom code would be helpful?
    Thank you.

    After looking over the passwordsync and jms resource notes I found my answer which was, java:com.waveset.adapter.jms.PasswordSyncMessageMapper
    Regards

  • Doubt in fields - message mapping (file 2 idoc scenario)

    while doing message mapping in file 2 idoc scenario, i could not able find the values for some field names
    ( i am following this wiki help
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/11/fileToIDOC& )
    cremas04 idoc
    vendorNo LIFNR
    vendor name Name1
    Pur_org   ? ( I could not able locate field with the similar desc in idoc MT side)
    Company code  ?
    Acc_Grp  ?
    Search term MCOD1
    Address ADRNR
    City ORT01
    Pin_code PSLTZ
    could you help me out with this?
    Message was edited by: praba
            praba

    hi,
    I got the answer.

  • Message Mapping - SUM a field per unique combination of 2 other fields?

    I'm receiving a proxy with detail records, and I need to create a subtotals file.  Here an example:
    BEFORE MAPPING
       <ROW>
          <KOSTL>0000010300</KOSTL>
          <POSID>DUMMY</POSID>
          <FTE>0.51</FTE>
       </ROW>
       <ROW>
          <KOSTL>0000010400</KOSTL>
          <POSID>123</POSID>
          <FTE>0.49</FTE>
       </ROW>
       <ROW>
          <KOSTL>0000010400</KOSTL>
          <POSID>DUMMY</POSID>
          <FTE>0.72</FTE>
       </ROW>
       <ROW>
          <KOSTL>0000010400</KOSTL>
          <POSID>123</POSID>
          <FTE>0.82</FTE>
       </ROW>
       <ROW>
          <KOSTL>0000010300</KOSTL>
          <POSID>DUMMY</POSID>
          <FTE>0.18</FTE>
       </ROW>
    AFTER MAPPING:
       <ROW>
          <KOSTL>0000010300</KOSTL>
          <POSID>DUMMY</POSID>
          <FTE>0.59</FTE>
       </ROW>
       <ROW>
          <KOSTL>0000010400</KOSTL>
          <POSID>123</POSID>
          <FTE>1.31</FTE>
       </ROW>
       <ROW>
          <KOSTL>0000010400</KOSTL>
          <POSID>DUMMY</POSID>
          <FTE>0.72</FTE>
       </ROW>
    How do I create a new record for all unquie combinations of KOSTL and POSID?  And total the FTE field for each line?  Can this be done in a message mapping?

    Hello,
    How do I create a new record for all unquie combinations of KOSTL and POSID? And total the FTE field for each line? Can this be done in a message mapping?
    Yes, very much possible with or without UDF. See sample mapping below without using UDF:
    For ROW:
    KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> collapseContext -> ROW
    POSID(set context to row) ->  /
    For KOSTL:
    KOSTL(set context to row) -> concat: ----------------> sortByKey: case insensitive ascending -> formatByExample -> collapseContext -> splitByValue:eachValue -> KOSTL
    POSID(set context to row) -> /      KOSTL(set context to row) ->/                                          /
    KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> /
    POSID(set context to row) ->  /
    For POSID:
    KOSTL(set context to row) -> concat: ----------------> sortByKey: case insensitive ascending -> formatByExample -> collapseContext -> splitByValue:eachValue -> POSID
    POSID(set context to row) -> /      POSID(set context to row) ->/                                          /
    KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> /
    POSID(set context to row) ->  /
    For FTE:
    KOSTL(set context to row) -> concat: ----------------> sortByKey: case insensitive ascending -> formatByExample -> sum -> splitByValue:eachValue -> FTE
    POSID(set context to row) -> /      FTE(set context to row) ->/                                            /
    KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> /
    POSID(set context to row) ->  /
    Hope this helps,
    Mark

  • Message Mapping - NewLine generation  in the target field

    Hi ,
    This is a File to SOAP scenario, where text file is picked by XI and posted to target using webservice in the xml format.In the message mapping, I am supposed perform a logic where 3 fields in the source structured are to be concatenated and sent to the target structure. This fields at the target structure are to be displayed with a newline character.
    So if I am sending : abc, 123 and xyz as input and  the output should be in one field as follows :
    <ns3:OutputField xmlns:ns3=abc
                                                  123
                                                   xyz</ns3:StreetAddressLine>
    I have used this "&#x0D;&#x0A;" as the seperator in the concat function, hoping this would produce a new line but was hopeless.
    Any ideas are appreicated.
    Thanks,
    Rag

    Hi Raghav,
    XML will never show new line or space characters.
    Try to open the message in notepad or wordpad and then check if you can see the new line character.
    -Supriya.

  • How to check a field in Message mapping wether it is Non Numeric?

    Hi XI Guru's
    I am totally new to XI world, Kindly help hopw can I chexk a field while doing message mapping whether the field is non numeric or not.
    I dont find any built in function for the same.
    If it is using UDF can some body help me in providoing a UDF for this.
    Many Thanks
    Arun

    Hi Arun,
    In SAP PI, all the XML contents by default treated as STRINGS.
    So if u want to check whether the incoming field is numeric or not... the only way is to write a UDF code for the same.
    the UDF will be,
    1. At first
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    in functions.
    2.UDF content:
    input: field,container
    output:boolean
    Code
    boolean return_Value;
    Pattern p = Pattern.compile("[0-9]*");          // If u are using the decimals please change the regular expression accordingly.
    Matcher m = p.matcher(field);
    if(m.matches())
    retuen_Value = true;
    else
    return_Value = false;
    return return_Value ;
    I hope this will solve ur problem....
    Babu

  • Searching a Field In Source or Target Message in Message Mapping

    Hey Guys,
                      I  came accross this peculiar behaviour and it keeps bugging me , I could search any field in source or target message in message mapping in PI 7.0 by copying the path( /ns1:MaestroAcreedores/Acreedores/ClaveDeGrupo or any idoc field /FIDCCP02/IDOC/E1FIKPF/BUDAT  ) but in PI 7.1 i cant , its giving me an error String /ns1:MaestroAcreedores/Acreedores/ClaveDeGrupo not found  , i can only search the field independently.Can anyone please help me out in this.

    Hi
    I am not sure whether it worked in 7.0 or not, but having checked myself i can confirm that it is not working in 7.1 in my system also.
    For alternative, you can check by changing into source text view where it will display as xml.  Here when you search the keyword, it would display you the hierarchy better than normal view.
    I dont think there is any other alternative. although I would say in the worst case scenario you would not have more than 10-15 occurrences of same element in an idoc.
    Regards
    Krish

  • Calling Message mapping Dynamically based on a field value

    Hi gurus,
    I have
    1 source inteface
    1 target interface
    3 Message mapping programs based on the 1 source and 1 Target Interfaces
    I need to decide Dynamically as which message mapping program should be called based on the Input provided by the source system.
    For example:
    If the souce side file sends a field value=1 then message mapping 1 should be called
    If the source side file sends a field value=2 then message mapping 2 should be used...
    Pls provide me help on this ASAP.

    As ur source and target structures are always same, u should have used same mapping with multiple conditions instead of using three different mappings.
    Right now for ur requirement, in ID -> standard Interface Determination, u can use multiple interface mappings based on condition.
    Check heading "Specifying Conditions (for Multiple Inbound Interfaces)" here
    http://help.sap.com/saphelp_nw04s/helpdata/en/42/ea20e737f33ee9e10000000a1553f7/content.htm
    Regards,
    Prateek

  • Multi-Message Mapping based on value of field - (Without BPM)

    Hi.
    I am having a bit of difficulty with multi-message mapping without BPM. I want to map to message1 & message2 based on a field in the rows of the source structure.
    e.g.
    row1-Source-Field1=> (if equal 0)   => <b>Message1</b>-field1.
    row2-Source-Field1=> (if equal 10) => <b>Message2</b>-field1.
    To attempt to do this, I use the conditions in the graphical mapper:
    if row-Source-Field1 = 0   => Map "Row to MessageType1".
    if row-Source-Field1 = 10 => Map "Row to MessageType2".
    However when I test this the mapping only seems to consider the first row value in row-Source-Field1 and ignores the fact that row two has a value of 10. I think this has something to do with contexts etc..
    I would appreciate any help please.
    Regards.
    Mick.

    in that case try this out
    row1-source-field1 (remove context) -- UDF -splitbyvalue-target
    UDF1(for message 1)
    for(int i=0;i<field1.length;i++)
    if(field1<i>.equals("0"))
    result.addValue(<field to be mapped><i>);
    UDF2(for message 2)
    for(int i=0;i<field1.length;i++)
    if(field1<i>.equals("10"))
    result.addValue(<field to be mapped><i>);

  • Message Mapping, filling field with 0 (zeros) on left

    I need to fill a field with values that has variable lenght adding 0 (zeros) on the left, how can I do it ?
    I'm using the LENGHT in message mapping, with value returned by LENGHT I use FIXVALUES to map the quantity of 0 (zeros) that I need to add in the field.
    Somebody can help me with this problem ?
    Thank's.

    Hi Regis,
    You can use the Arithmetic:FormatNum built-in function for this.
    If you want to left-pad the number with zeros so that the length is always 10, then specify 10 zeros for the format, 0000000000.
    This function takes formats based on java.text.DecimalFormat so you can see all of the possibilities at:
    java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
    Thanks,
    Jesse

  • Message mapping not generating target fields

    hi
    iam doing jdbc--->rfc (bpm) created a one2one message mapping to import rfc table.
    thanks in advance
    sri

    Hi Sri Rao,
    Since you have created a one to one mapping, it would be required to map all the fields in your target message to ur source fields. In case there r some target fields which do not relate to your source field, map it onto a constant. This is all that is required to be done from what i understand from your query. In case there r further problems send the source n target data structure n i will be able to help you out better.
    Cheers,
    Christina

  • Mapping a message in different types of messages depending field value

    Hi gurus!
    I need your help!, I need to create a scenario where I receive a message with a JMS adapter, for which I define an outbound service interface type, but depending on the value of a field (interface) to map in order to create different service inbound interface type.
    For example, I get the MT that is associated with a Service Interface SI_OUT:
    <MT_TRX>
       <interface> 101 </ Interface>
       <message>
             nombre="AVISO"> <campo 8500070609 </ field>
             nombre="ESTADO"> <campo PCDS </ field>
       </ MESSAGE>
    </ MT_TRX>
    As the interface has the value 101 with a Message Mapping I want to create the Service Interface SI_IN_101 whit message type MT_101.
    If interface = 102, the Service Interface should be SI_IN_102 and message type_102... etc.
    Can be mapped to different types of Service Interface, need different Operations?
    Thank you very much for your help, I don't know how to solve the problem!

    Hi Veronica,
    There are two clear options to approach the solution: be it 7.11 or earlier
    1. Go for 1..Onbounded Operation mapping. In your operation mapping on the target side add the different inbound interfaces. You have to define seperate message mappings for each of your target message types and use them in the operation mapping.
    2. The rather simplistic solution would be to go for conditional interface determination. A well know approach, if you have multiple interfaces to be mapped from a single interface for the same receiver system. Define seperate Message and Operation mappings for each of your Inbound Interfaces and then in Integration Directory use conditional Interface determination to call the appropriate operation mapping based on the condition checking on input payload (XPath).
    I will strongly suggest the second option for better maintainability and monitoring of your interface.
    You certainly dont need multiple operations, that's for different purpose altoghether
    Regards,
    Suddhasatta

  • Send Multiple field values to Single Target field in Message Mapping

    Hi,
    My  Requirement is to Map Multiple fields to Single field in Target side.I have to send all the values concatenated and pass the same to target Field in Message Mapping.
    We can use Concat function,but more that 15 fields are there.If using concat,the mapping will be complex.
    Is there any way to simplify this requirement or we can use any UDF for this,kindly suggest.
    Regards,
    Madhu

    >>>We can use Concat function,but more that 15 fields are there.If using concat,the mapping will be complex.
    I don't think it's complex but  just that it occupies more mapping area
    Just write a simple UDF - a one line code and pass all your input variables.
    return var1+var2+var3+var4+...+var15;

  • Display queue for Target field in Message Mapping

    Hi Folks,
    If i check my Target Field (DT_Req) (Display queue) in Message Mapping, I am getting 2 values like ie [] that means ....in my test result in MM, i should get 2 times DT_Req field.
    Is it right?
    Plz give some idea how this display queue works on each field?
    Thanks
    Prabaharan
    Edited by: Prabaharan on Sep 10, 2008 12:22 AM
    Edited by: Prabaharan on Sep 10, 2008 12:24 AM

    Hi,
    In my scenario occurrence of that
    target field is    0...unbounded
    and in my display queue.. Initially it is
    suppress, [], suppress, suppress, suppress,suppress,suppress,suppress,suppress,suppress, [],suppress
    in my result i could get only one DT_req field.
    Plz throw some idea on this?
    thanks

Maybe you are looking for

  • Creating a Time Delay Between 2 Waveforms

    Hi, Please bear with me while I explain what I'm trying to do :-)   Basically, in the attached LabView file ("flow vis + trigger-m.vi"), I am generating 2 signals: a sinusoidal waveform (used to drive an actuator) and a square waveform (used as a TTL

  • Can I use my MacBook Pro with 10.7.5 with Epson Stylus Printer photo R340

    MacBook Pro with 10.7.5 with Epson Stylus Printer photo R340 can I make them work togather?

  • Parsing later version PDF documents for page count

    We send a large number of contracts in PDF format to an EDI application and need to know the page count in advance. We currently use a perl script to parse the PDF files for the following: 1 0 obj << /Type /Pages /Kids [ 13 0 R 16 0 R /Count 2 >> end

  • Burning a DVD with m4v music videos purchased from iTunes

    Instead of buying Apple TV, I would like to burn a DVD with my collection of music videos purchased on iTunes. Most of them are Protected MPEG-4 video files, having the extension .m4v My question what I need to do to burn a DVD with these files, with

  • Video not working properly

    I tried installing all sorts of codecs, only to find that totem, and every other video/audio viewer was unable to play my file (it's avi). With totem I get a message saying Divx mp4 decoders are not install. In ffplay, mplayer, and vlc I get "illegal