Message Mapping - Flat structure to more complex structure

Hi,
Whats the best approach to map from
<resultset>
  <row>
    <CONTENTS>H1xxx</CONTENTS>
  </row>
  <row>
    <CONTENTS>P1-1xxx</CONTENTS>
  </row>
  <row>
    <CONTENTS>P1-2xxx</CONTENTS>
  </row>
  <row>
    <CONTENTS>H2xxx</CONTENTS>
  </row>
  <row>
    <CONTENTS>P2-1xxx</CONTENTS>
  </row>
</resultset>
to
<Payment>
  <header>
    <CONTENTS>H1xxx</CONTENTS>
  </header>
  <items>
    <CONTENTS>P1-1xxx</CONTENTS>
    <CONTENTS>P1-2xxx</CONTENTS>
  </items>
</Payment>
<Payment>
  <header>
    <CONTENTS>H2xxx</CONTENTS>
  </header>
  <items>
    <CONTENTS>P2-1xxx</CONTENTS>
  </items>
</Payment>
i.e. map Contents to header if it starts with H, to item if it starts with P
Payment consists of one header plus the items that follow it.
I can't seem to get the contexts in the target message correct

Thanks for all responses.
Hi Baz!
Yes, I've looked at SplitByValue, could never get exactly what I wanted though.
Praveen, I'll give XSLT a go then.
Stefan, Unfortunately the source message is coming through the JDBC not the file adapter. I agree, a file would be much easier to handle with the advantage of the FCC options

Similar Messages

  • Mapping flat xml file to xml Structure

    Hi all,
    i have to map an xml file, wich is incoming via a RFC call in a flat import field, to a xml-Structure. The xml Structure has the same Structure except that it is not flat but even as a xml-Structure in the Repository. Ist ther a way to make a 1:1 - Mapping?
    Regards Mathias

    Hi,
    This can be done very easily using Java Mapping.
    Parse the flat xml String using Dom4j and directly set this as the target structure.
    eg code:
    public void execute(InputStream in, OutputStream out) throws StreamTransformationException{
    String flatXml = "the flat xml string";
    Document doc = DocumentHelper.parseText(flatXml) ;
    out.write(doc.asXML().getBytes());
    Regards,
    P.Venkat

  • PI Message Map - useOneAsMany issue with more than 10 lines.

    I am having an issue using 'useOnAsMany' .  I am using this to map lines of text from an idoc, specifically the SHPMNT04 idoc.  When there are more than 10 lines of text (i.g. 10 occurances of E1TXTP8) the sytem drops everything after the 10th line.  When I check the context of the fields it appears all occurances are being mapped however when I execute the map it drops the text after the 10 line.  Is this a bug?  Has anyone seen this and know of an answer?
    I am using 'useOneAsMany' with E1TXTH8-TDID as the first argument and E1TXTP8-TDLINE as the second and third arguments.  I am simply moving all the text when TDID = Z001.

    Hi Busse,
    Can you check the occurence of the target field to which you are mapping? If it is 0..10 then you will only 10 lines in outupt, else it should get populated.
    Regards,
    ---Satish

  • PI 7.11: IDoc Message mapping

    Hi there,
    I'm currently working on a graphical message mapping using IDoc HRMD_A06 as source structure (HR master data transferred via PFAL).
    In my result structure I have to fill a field CostCenter with the following logic:
    If field KOSTL (cost center) is filled in node E1P0315, map this field to CostCenter in result structure, otherwise take KOSTL of node E1P0001.
    The end date (ENDDA) has to be '99991231' in each case.
    This is how the result structure looks like:
    <e>                       [1...1]
      <CostCenter>            [1...1]
    </e>
    This is the simplified source structure:
    <E1PLOGI SEGMENT="1">
      <E1PITYP SEGMENT="1">                        [0...n]
         <E1P0001 SEGMENT="1">                     [0...n]
           <INFTY>0001</INFTY>                     [0...1]
           <ENDDA>99991231</ENDDA>                 [0...1]
           <KOSTL>0000012345</KOSTL>               [0...1]
        </E1P0001>
      </E1PITYP>
      <E1PITYP SEGMENT="1">                        [0...n]
        <E1P0315 SEGMENT="1">                      [0...n]
          <INFTY>0315</INFTY>                      [0...1]
          <ENDDA>99991231</ENDDA>                  [0...1]
          <KOSTL>0000024001</KOSTL>                [0...1]
        </E1P0315>
      </E1PITYP>
    </E1PLOGI>
    How can I do the check if field KOSTL of node E1P0315 is null?
    I've tried an existence check for the whole node (E1P0315->exists), but then it fails, because all E1PITYP nodes are processed.
    I hope my problem is clear to you.
    Would it be better to use another mapping type?
    As I'm an ABAP developer, I would of course prefer some lines of code to this graphical drag&drop thing.
    Thanks in advance!

    Cheers, guys!
    I did it now like that:
    http://www.abload.de/image.php?img=mappingflknz.jpg
    Click on the image to enlarge it!
    The logic is as following (ABAP Pseudo-code ):
    IF 0315_KOSTL and 0315_ENDDA are populated.
      IF 0315_ENDDA equals '99991231'.
        map 0315_KOSTL to Cost_Center.
      ENDIF.
    ELSE.
      IF 0001_KOSTL and 0001_ENDDA are populated.
        IF 0001_ENDDA equals '99991231'.
          map 0001_KOSTL to Cost_Center.
        ENDIF.
      ENDIF.
    ENDIF.
    Is that a good way to do that mapping?
    Do I also have to use the removeContexts function or is it ok like that?
    Could I also do that with an ABAP mapping program?
    Thanks in advance!

  • Message Mapping Issue in PI 7.1

    Hi Experts
    I am working on a Message mapping,  and I have the following structures on the Sender and receiver side
    -->InterfaceHeader
    -->DocumentHeader  (1-Unbounded)
    -->DocumentLineItems (1-Unbounded)
    -->InterfaceTrailer -1
    Same structure on the sender and Receiver, I am sending the data as follows
    -->InterfaceHeader
    -->DocumentHeader1
    -->DocumentlineItems1
    -->DocumentHeader2
    -->DocumentlineItems2
    -->InterfaceTrailer -1
    after mapping I am getting the following results
    -->InterfaceHeader
    -->DocumentHeader1
    -->DocumentHeader2
    -->DocumentlineItems1
    -->DocumentlineItems2
    -->InterfaceTrailer -1
    i.e Header 1 and 2 are coming same and then details are coming, I need the result xml the same way which I have sent.
    find the example payload below, please let me know how can I get the structures in the same order of the sender payload.
    results should be
    -->InterfaceHeader
    -->DocumentHeader1
    -->DocumentlineItems1
    -->DocumentHeader2
    -->DocumentlineItems2
    -->InterfaceTrailer -1
    Thanks
    PR

    Check this blog...you have solution for this
    /people/shabarish.vijayakumar/blog/2010/01/14/file-conversion-using-nodeception

  • UDF for leading zero's in message mapping

    Dear team,
    I need UDF for leading zero's in my message mapping.
    Source and Target both structures contains matnr field.But we have to maintain total 18 chars at target matnr , because RFC in R/3 needed.So I want to add leading zero's when mapping. Can anybody provide the UDF code.
    Matnr[source]--->split by value(eachvalue) ->UDF->Matnr[Target]
    Ex::if source matnr conatains value "9846538" ; I need matnr value at target side like "000000000009846538"[total 18 chars].
    -Drumi

    Hi Ambrish,
    Good day...
    I have enterd what you said and I got below error... and I gave "input" in place of var1, 18 in place of filedlenght in below program...
    =================================
    int len = Integer.parseInt(18);
    int inputLength = input.length();
    try {
    Integer.parseInt(input);
    // If it is an integer, add 0 (len - inputLength) times
    for (int i=0; i< len-inputLength;i++)
        input = "0" + input;
    return input;
    } catch (NumberFormatException numForEx) {
    // return as it is, if alphanumeric
    return input;
    ====================================
    ERROR:
    Source text of object Message Mapping: Lubrisur_SHPMNT_SHPMNT05_TO_WMMBXY_WMMBID02_TransferPosting | urn:bp:xi:dwn:lu:common:Logistics:100 has syntax errors:
    Function LeadingZeros, Line 1:
    cannot find symbol symbol  : method parseInt(int) location: class java.lang.Integer int len = Integer.parseInt(18);                  ^ 1 error
    =======================
    Please suggest

  • Message Mapping Error : "already dropped from buffer"

    Hi,
    today we have a new strange error in a simple message mapping File2IDoc thats results in SYSFAIL.
    Maybe a buffer or memory error?
    In short:
    +/ARTMAS05/IDOC/E1BPE1MARART[2]/DELN_DATE(suppressed field); root message: Index 2147483647 is already dropped from buffer. Cur offset is 2147483636+
    In detail:
    #2.#2010 08 18 10:49:51:619#+0200#Error#/Applications/ExchangeInfrastructure#
    #BC-XI#com.sap.xi.util.misc#0026557C6A4004B6000000000000120D#229073650000000872#sap.com/com.sap.xi.services#com.sap.aii.ib.server.mapping.execution.JavaMapping#J2EE_GUEST#0#SAP J2EE Engine JTA Transaction : #0A1BAF81AA0111DF82D40026557C6A40#0a1baf81aa0111df82d40026557c6a40#0a1baf81aa0111df82d40026557c6a40#0#output#Java##
    RuntimeException during appliction Java mapping com/sap/xi/tf/_xxxxx_Out_To_ARTMAS_ARTMAS05_A1_
    Thrown:
    com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-field mapping /ARTMAS05/IDOC/E1BPE1MARART[2]/DELN_DATE(suppressed field); root message: Index 2147483647 is already dropped from buffer. Cur offset is 2147483636
    #2.#2010 08 18 10:52:45:149#+0200#Error#/Applications/ExchangeInfrastructure#
    #BC-XI#com.sap.xi.util.misc#0026557C6A4004BA000000000000120D#229073650000000872#sap.com/com.sap.xi.services#com.sap.aii.ib.server.mapping.execution.JavaMapping#J2EE_GUEST#0#SAP J2EE Engine JTA Transaction : #0A1BAF81AA0111DF82D40026557C6A40#0a1baf81aa0111df82d40026557c6a40#0a1baf81aa0111df82d40026557c6a40#0#output#Java##
    RuntimeException during appliction Java mapping com/sap/xi/tf/_xxxxx_Out_To_ARTMAS_ARTMAS05_A1_
    Thrown:
    com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-field mapping /ARTMAS05/IDOC/E1BPE1MARART[2]/DELN_DATE(suppressed field); root message: Index 2147483647 is already dropped from buffer. Cur offset is 2147483636
    Thanks in advance,
    André

    Hi André, did you try to re-create de Message Mapping with the same source/target structures?
    Regards,
    Juan.

  • Message Mapping from flat XML to a Record structure

    Hi All,
    We have a scenario in which the input message is a PDF document. we are following below the blog to convert PDF to XML format which uses <b>PDF box utitlity</b>.
    /people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter
    We are able to convert the PDF doc to a flat XML file.
    Now we have the following queries...
    what are the different ways to map the flat XML to our record structure?
    Do we have any utitlity in PDF box to do that?
    Regards,
    Rakesh.

    Hi Rakesh,
    You have Graphical mapping, Java mapping, ABAP mapping and XSLT mapping. The choice depends on the scenario and what target result you require.
    <b>Message mapping using graphical mapping editor:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/49/1ebc6111ea2f45a9946c702b685299/frameset.htm
    <b>XSLT mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    <b>Java Mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    <b>ABAP mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/frameset.htm
    As said earlier, graphical mapping is the simplest and quite a few built in options are available with it, explore it and see which is suitable for your scenario.
    Regards,
    Chandra

  • Sender File adapter complex structure FCC issue - flat structure RFC-stuck

    Hi,
    Please help.
    I have a the below file structres-
    Option 1-
    H,100890,P100,A02,S101,AUD#
    I,P,NULL,TH,Test PO TH,1,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    I,P,NULL,TH,Test PO TH1 2,2,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    H,100899,P100,A02,S101,GBP#
    I,P,NULL,AS,Test PO AS1,1,EA,100,10160000,A002,0001,720090,E.1.4.2,,,,VT#
    I,P,NULL,AS,Test PO AS12,2,EA,100,10160000,A002,0001,720090,E.1.4.2,,,,VT#
    I need to map this into a Z RFC which is expecting all the data in one row - of course multiple rows
    Option 2-
    Same structure as above but all in same row-
    H,100890,P100,A02,S101,AUD,P,NULL,TH,Test PO TH,1,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    I,100890,P100,A02,S101,AUD,P,NULL,TH,Test PO TH,1,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    I,100890,P100,A02,S101,AUD,P,NULL,TH,Test PO TH1 2,2,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    H,100899,P100,A02,S101,GBP,P,NULL,AS,Test PO AS1,1,EA,100,10160000,A002,0001,720090,E.1.4.2,,,,VT#
    I,100899,P100,A02,S101,GBP,P,NULL,AS,Test PO AS1,1,EA,100,10160000,A002,0001,720090,E.1.4.2,,,,VT#
    I,100899,P100,A02,S101,GBP,P,NULL,AS,Test PO AS12,2,EA,100,10160000,A002,0001,720090,E.1.4.2,,,,VT
    This also needs to be mapped into a Z RFC which is expecting all the data in one row - of course multiple rows
    I am getting issues in getting the file data across to Receiver adapter.
    I have tried various combinations but the message is failing in SXMB_MONI.
    How do i do it as i need to get the finalised option for incoming file structure?
    Option 1 is being stressed but how do i map it if i cannot get the receiver structure in RFC.
    Please help as I am stuck now.
    Regards,
    Archana

    Hi,
    The problem is basically in message mapping from file to RFC external message.
    The option 2 is working now and I get correct converted file strcuture after FCC and into RFC and also a correct RFC payload.
    However, business is stressing that can send the file in the format as given in Option 1 where u have different structure - Header and Items. This is not coming out correct in RFC payload as the header has 5 fields as compared to more in item but the header and item are still being mapped to the flat RFC structure and this is creating a mismatch. The item line is missing the 5 fields from Header.
    How do i do the FCC in this situation to get the correct structure in RFC?
    This means that in RFC payload, the first line should be the one as below-
    H,100890,P100,A02,S101,AUD#
    The 2 records after this as received in RFC internal table should be as 2 given below-
    I,P,NULL,TH,Test PO TH,1,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    I,P,NULL,TH,Test PO TH1 2,2,EA,100,10160000,A002,0001,720090,E.1.4.3,,,,VT#
    However, the 2 structures contain variable field columns.
    Please help.
    Regards,
    Archana

  • Problem to transform Flat file to Data Type Structurated and map to IDOC

    Hi all,
    I have a file to idoc scenario.
    The information is like this:
    1#!445#!AI12#!1#!20070214#!DVXXXXR#!201#!31GINHG876#!#!
    2#!#!ETC
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    where 1, 2, ... = key segments for the file adapter and #! are the field separator.
    this must go to a Data Type with substructures like this:
    (xml)
    .1
    ......2
    .3
    ......4
    ......5
    where 2 is inside 1 and 4-5 inside 3.
    The reason of this is we can get unbounded replays of 3/4/5 for one header.
    But XI reads the information like if all segments are headers.
    .1
    .2
    .3
    .4
    .5
    So the IDOC is bad created.
    Where is the issue?  At Message Mapping all substructures are mapped with his default and at TEST option it works fine.
    Thanks in advance for your help.
    best regards
    Message was edited by:
            Federico Martin
    Message was edited by:
            Federico Martin

    Dear people,
    according to license problems at client, it's impossible to get the convert agent.
    so now we come back to try to solve with normal mapping.
    the next step is try to convert it using 2 message mappings: dt (flat xml) to dt (structurated) and this one to the idoc.
    i suppose it can be done adding program at interface mapping.
    I created the no hiereachical Data Type for load the information and it's fine. But i am unable to get the first mapping OK, because XI has problems with unbounded segments.
    If you agreed and has time, i copy here the information and his structure.
    I receive (#! defines separation and key segment fields are 1,2,3,4,5):
    1#!445#!AH02#!1#!20070214#!DVPOSTER#!201#!31GINHGIN0#!#!
    2#!#!ETC
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    5#!pos5
    5#!pos5
    The destination must be:
    CHASE A
    1 (1..1)
    ....2 (1..1)
    3 (1..unbounded)
    ....4 (0..1)
    3 (1..unbounded)
    3 (1..unbounded)
    ....4 (0..1)
    5 (1..unbounded)
    5 (1..unbounded)
    5 (1..unbounded)
    CHASE B
    Or, in another case with 5 as child of 3 (like example in last mail)
    1#!445#!AH02#!1#!20070214#!DVPOSTER#!201#!31GINHGIN0#!#!
    2#!#!ETC
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    5#!pos5
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    1 (1..1)
    ....2 (1..1)
    3 (1..unbounded)
    ....4 (0..1)
    ....5 (1..unbounded)
    3 (1..unbounded)
    ....5 (1..unbounded)
    3 (1..unbounded)
    ....4 (0..1)
    ....5 (1..unbounded)
    3 (1..unbounded)
    ....4 (0..1)
    ....5 (1..unbounded)
    Questions:
    How i do for map Data Type (no hierachical) -to-> Data Type (hierachical) and  Data Type (hierachical) -to-> IDOC? Is any loop or context object required?
    Thank you in advance for your help and sorry the long thread.

  • Mapping of complex structure in XI

    Hi friends,
    I have a RFC to SOAP scenario in XI. As a response message they have given a structure with single field in it. But when it is coming over, it has a complex structure, I need to break it to different fields in my internal table. The response I have is given below.
    <Result><Response><FileID _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">1992143</FileID><AuthID xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="i4">195894</AuthID><MessageList _Inserted="1"><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Domain value is invalid for field FilePriority (Client Name), Priority Type (Cartus Name) . The value received was SFNR.</Message><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">The Destination Location State/Province is invalid. The State/Province was deleted and appended to City/Town. The value was Chennai.</Message><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Received Authorized Initiator (Nambissan, Rajesh) is not an active contact for client/division, Default Initiator was used.</Message></MessageList></Response></Result>
    From this I need to seperate the fileid, authid, messages seperately. Can anyone please suggest how I can do that.
    Thanks in advance for your help.
    Anjana.

    Hi,
    I created a .xsl file using Altova MapForce with the result xml I got from the other system and xml created from my RFC.
    I created a zip file using that .xsl and imported it in archives, and used it in Interface mapping. Now, it is not giving me any error but the mapping is not happening as I expected. I m getting some weird result.
    The .xsl file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n2="http://tempuri.org/message/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:sap-com:document:sap:rfc:functions" xmlns:dt="urn:schemas-microsoft-com:datatypes" exclude-result-prefixes="dt n2 xs xsi xsl" xmlns="urn:sap-com:document:sap:rfc:functions">
         <xsl:namespace-alias stylesheet-prefix="n" result-prefix="#default"/>
         <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
         <xsl:template match="/">
              <ns1:Z_PA_SAP_TO_CENDANT.Response>
                   <xsl:attribute name="xsi:schemaLocation">
                        <xsl:value-of select="'urn:sap-com:document:sap:rfc:functions C:/DOCUME~1/asankara/Desktop/Z_PA_SAP_TO_CENDANT.xsd'"/>
                   </xsl:attribute>
                   <xsl:variable name="var1_instance" select="."/>
                   <IT_ERROR>
                        <item><xsl:for-each select="$var1_instance/n2:AuthorizationResponse/Result/Response/MessageList/Message">
                                  <ERROR_DESC>
                                       <xsl:value-of select="string(.)"/>
                                  </ERROR_DESC>
                             </xsl:for-each>                      </item>
                   </IT_ERROR>
                   <IT_RESPONSE>
                        <item>
                             <xsl:for-each select="$var1_instance/n2:AuthorizationResponse">
                                  <FILEID>
                                       <xsl:value-of select="number(string(Result/Response/FileID))"/>
                                  </FILEID>
                             </xsl:for-each>
                             <xsl:for-each select="$var1_instance/n2:AuthorizationResponse">
                                  <AUTHID>
                                       <xsl:value-of select="number(string(Result/Response/AuthID))"/>
                                  </AUTHID>
                             </xsl:for-each>
                        </item>
                   </IT_RESPONSE>
              </ns1:Z_PA_SAP_TO_CENDANT.Response>
         </xsl:template>
    </xsl:stylesheet>
    Should I make any changes in the file that is created in Mapforce?Please help.
    Thanks,
    Anjana.

  • Message mapping 2D structure

    Please excuse me, this seems to be a very simple issue but being resonably new to message mapping I am having issues solving it.
    Ok each field maps to a repeating structure in the target IDOC, I ahve duplicated the subtree in the Structure and mapped each of the fields.
    _Source_                    _Desired_                                      _Actual_
    <header>                    <header>                                          <header>           
      <line1>                     <line1>                                           <line1>
         <Field1>                    <Field1>                                           <Field1>
         <Field2>     Message        <Field2>                                           <Field2>
         <Field3>       Mapping       <Field3>                                          <Field3>
       <line2>           ------>   <line2>                                               <Field4>
         <Field4>                      <Field4>                                         <Field5>
         <Field5>                      <Field5>                                         <Field6>   
         <Field6>                      <Field6>                                     <line2>
    Each lineNode has been mapped across, and the FieldNode's have been mapped to the line as well. I have had to map the lineNode to the fieldNode as well as I am duplicating the subtree for the fieldNode which is 1..N range.
    My issue is all the fields are mapping into the first node and not maintaining their structure. The value in the fields is coming through correctly in the repeating structure but the node itself is misplaced.

    Thought it was solved ... it isnt...
    To clafiry...
    There are fields in the incoming structure that map into Nodes in the target structure ...
    So Field1 in Line1 .... will actually become Field1Node in the target. To add addition complexity the target node is a repeating node, so used the copt subtree feature but I think it is loosing context.
    So...
    <lineNode1>    -
    > <lineNode1>
        <field1>      -
    >     <FieldNode1>
                                                               <field1 value>
                                                               <field1 constant> --- provided by PI
        <field2>     -
    >    <FieldNode2>
    and so on .... basically the fields in the originating message and creating a bunch of nodes in the user exit, With some small constants to hardcoded in PI to add context to the value in the field.
    A real example ...
    <saleLine1>                                             <saleLine1>
    <saleValue>100</saleValue>                                 <userExitGenericNode>
    </saleLine1>                                                    <Value>100</Value>
                                                                     <ID>SaleValue</ID>
                                                                </userExitGenericNode>
                                                            </saleLine1>

  • Mapping : Complex Structured Source to JDBC receiver structure

    Hello...
    We have a source structure as
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MTO_Corporate xmlns:ns0="http://axis.com/authorization">
       <Details>
          <Corporate_Details> ---------- (occurence 1 to n)
             <ID/>
             <Name/>
             <Address/>
             <Delivery_Address/>
             <Email_ID/>
             <Request_Limit/>
             <Total_Limit/>
             <Used_Limit/>
             <Availability_Limit/>
             <Sanction_Date/>
             <Created_By/>
             <Created_Date/>
             <Fax_No/>
             <Max_Authorizers/>
             <Account_Details> ---------- (occurence 1 to m)
                <Corp_Acc_Type/>
                <Corp_Acc_Num/>
                <Branch_Code/>
                <Branch_Name/>
                <Bank_City/>
             </Account_Details>
             <Department_Details> ---------- (occurence 0 to x)
                <Dept_Code/>
                <Dept_Name/>
             </Department_Details>
             <Designation_Details>---------- (occurence 0 to y)
                <Desig_Code/>
                <Desig_Name/>
             </Designation_Details>
             <Status/>
             <State/>
          </Corporate_Details>
       </Details>
    </ns0:MTO_Corporate>
    In this structure, each corporate can have more than one accounts and departments and designations. We need to map this with the following target structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MTI_Corporate_DB xmlns:ns0="http://axis.com/authorization">
    <StatementCorporate>
    <AXIS_STORED_PROCEDURE action="EXECUTE">
    <Table>SP_CORPORATE_MASTER_INSERT</Table>
    <f_corp_code isInput="true"></f_corp_code>
    <f_corp_name isInput="true"></f_corp_name>
    <f_corp_addr1 isInput="true"></f_corp_addr1>
    <f_corp_addr2 isInput="true"></f_corp_addr2>
    <f_primary_email isInput="true"></f_primary_email>
    <f_corp_req_limit isInput="true"></f_corp_req_limit>
    <f_corp_total_limit isInput="true"></f_corp_total_limit>
    <f_corp_upper_limit isInput="true"></f_corp_upper_limit>
    <f_corp_avail_limit isInput="true"></f_corp_avail_limit>
    <f_effective_from isInput="true"></f_effective_from>
    <f_created_by isInput="true"></f_created_by>
    <f_created_date isInput="true"></f_created_date>
    <f_corp_fax isInput="true"></f_corp_fax>
    <f_Max_Authorizers isInput="true"></f_Max_Authorizers>
    <f_corp_acc_type isInput="true"></f_corp_acc_type>
    <f_corp_acc_num isInput="true"></f_corp_acc_num>
    <f_corp_branch_code isInput="true"></f_corp_branch_code>
    <f_corp_branch_name isInput="true"></f_corp_branch_name>
    <f_corp_bank_city isInput="true"></f_corp_bank_city>
    <f_corp_dept_code isInput="true"></f_corp_dept_code>
    <f_corp_dept_name isInput="true"></f_corp_dept_name>
    <f_corp_desig_code type="true"></f_corp_desig_code>
    <f_corp_desig_name isInput="true"></f_corp_desig_name>
    <f_corp_enable isInput="true"></f_corp_enable>
    <f_corp_status isInput="true"></f_corp_status>
    <p_err_msg isOutput="true" type="VARCHAR">
    </p_err_msg><p_status isOutput="true" ype="VARCHAR">
    </p_status>
    </AXIS_STORED_PROCEDURE>
    </StatementCorporate>
    </ns0:MTI_Corporate_DB>
    Yes, we are using a stored procedure which will insert 5 tables. The problem is in the mapping between souce and target fields.
    Plese provide your inputs on this query.
    Regards
    Suraj

    Hi Manisha,
    >>U need to create number of target message as that of number of account details so that it will be one query for ur database.
    Yes this could have been done if we were sure that a corporate will have more accounts than departments/designations... But that is not always the case.
    >>So map ur source <account_details> node with target root node and change context of <account_detail> to <details>..these will create number of target messages.
    So what I did is to check the larger of account, department and designation and then repeat the traget strucutre that much times...
    >>Now map ur target node with account, dept, and designation details by changing it context to root node
    But still I have some elements like ID, name etc.which comes one for each corporate and they also needs to repeated.. I am thinking that this will not be an easy solution.
    Anyway thanks for the reply and please keep updated if you have any other idea.
    Regards
    Suraj

  • Map flat to nested structure by creating a collection

    Hi All,
    I've got a problem by mapping a flat to a nested structure.
    The source structure looks like that:
    <b>ISIN</b> = DE00000123450
    <b>WKN</b>  = 012345
    The target structure is build as a collection of identifers:
    <i><b>IDENTIFIER (1..unbounded)</b></i>
    <b>ID</b>    = 01
    <b>TYPE</b>  = Isin
    <b>VALUE</b> = DE00000123450
    <b>ID</b>    = 02
    <b>TYPE</b>  = Wkn
    <b>VALUE</b> = 012345
    Now, it's impossible for me to append a new record to this identifier collection by using the plain mapping functionality without java functions.
    Did anybody face and solve this problem?

    Hi Bhavesh, Marcus,
    I'd like to refine the above problem somewhat ..
    The main problem here is not to map an element name of a source document to an element value of a destination document, but to construct a collection from a list of source element values (Isin->Value, Wkn->Value):
    ("." are just for prettyprinting)
    Source_1:
    <PRICES>
    ....<Price>
    ........<Isin>DE0123456</Isin>
    ........<Wkn>123456</Wkn>
    ........<Currency>USD</Currency>
    ........<Amount>123.45</Amount>
    ....</Price>
    ....<Price>
    ........<Isin>DE0123457</Isin>
    ........<Wkn>123457</Wkn>
    ........<Currency>EUR</Currency>
    ........<Amount>987.65</Amount>
    ....</Price>
    </PRICES>
    Destination_1:
    <PRICES>
    ....<Price>
    ........<IDENTIFIERS>
    ............<Identifier>
    ................<Key>ISIN</Key>
    ................<Value>DE0123456</Value>
    ............</Identifier>
    ............<Identifier>
    ................<Key>WKN</Key>
    ................<Value>123456</Value>
    ............</Identifier>
    ........</IDENTIFIERS>
    ........<Currency>USD</Currency>
    ........<Amount>123.45</Amount>
    ....</Price>
    ....<Price>
    ........<IDENTIFIERS>
    ............<Identifier>
    ................<Key>ISIN</Key>
    ................<Value>DE0123457</Value>
    ............</Identifier>
    ............<Identifier>
    ................<Key>WKN</Key>
    ................<Value>123457</Value>
    ............</Identifier>
    ........</IDENTIFIERS>
    ........<Currency>EUR</Currency>
    ........<Amount>987.65</Amount>
    ....</Price>
    </PRICES>
    So the main question for me seems to be: How to do the transpose of Isin and Wkn to the Value elements:
    Source_2:
    <Price>
    ....<Isin>DE0123456</Isin>
    ....<Wkn>123456</Wkn>
    ....<Currency>USD</Currency>
    ....<Amount>123.45</Amount>
    </Price>
    Destination_2:
    <Price>
    ....<IDENTIFIERS>
    ........<Value>DE0123457</Value>
    ........<Value>123457</Value>
    ....</IDENTIFIERS>
    ....<Currency>EUR</Currency>
    ....<Amount>987.65</Amount>
    </Price>
    Since the length of the source list has very few items (comparable to columns in a database table), they could easily be set as constant Key's in the destination. The problem is: how to map element values of different source elements  (Isin, Wkn) into a collection of destination elements (comparable to rows in a database table). The mapping from Destination_2 to Destination_1 could be done by a SplitByValue.
    I couldn't find a mapping in the GUI which allows to do the latter mapping. More precisely to sort-of reference the destination elements by an index or to simply add more elements to the collection without overwriting the first one.
    A Java Mapping doesn't seem to be appropriate, since it seems, that only 1 result value can be returned (or is it possible to modify the destination DOM/XML with a Java Mapping ? Or to return a list of values ?).
    An XSLT Mapping seems to be possible, but unfortunately it imposes bigger efforts when additionally conversions or value-mappings are needed.
    In the case that XSLT mapping is the only solution to the problem: is it possible, to do a XSLT mapping pipelined with a GUI mapping, such that the structural mapping can be done by XSLT and the conversions / value-mappings can be done via the GUI ?
    Best regards,
    Marc

  • Error while forming Structur in Message Mapping.

    Hi ,
    I have taken source payload from Moni and tried to test the Message mapping.
    When i paste the Pay load in Test tab,under XML, my structure is getting well formed., But 3 feilds from structure is showing in Red color.
    Please advice
    Regards
    Dinesh

    Hi Dinesh,
    Please cross check with filling the values into the test tab and display it in source xml format and copy in notepad and compare with the payload data there must be some tag problem.
    Thanks!
    Edited by: Sudhir Tiwari on Nov 25, 2008 2:20 PM

Maybe you are looking for