Complex Mapping Question

Hi,
i have a xml structur like that:
<root>
     <header>
          <nr>00010</nr>
     </header>
     <header>
          <nr>00102</nr>
     </header>
     <item>
          <nr>00010</nr>
          <value>20</value>
          <wight>60</wight>
     </item>
     <item>
          <nr>00102</nr>
          <value>30</value>
          <wight>30</wight>
     </item>
     <desc>
          <nr>00010</nr>
          <name>Meet</name>
     </desc>
     <desc>
          <nr>00102</nr>
          <name>Apple</name>
     </desc>
</root>
and want that it looks like that:
<root>
     <item>
          <nr>00010</nr>
          <name>Meet</name>
          <value>20</value>
          <wight>60</wight>
     </item>
     <item>
          <nr>00102</nr>
          <name>Apple</name>
          <value>30</value>
          <wight>30</wight>
     </item>
</root>
for each header tag in source message it must be a item tag in target message.
can i handle this with a XSLT Mapping ?
any Idea?
for me its looks very difficult to do that in a mapping.
Regards,
Robin

I think you have your source xml wrong. Try getting your source xml structure to be something like below, the reason being you cannot do a loop (for-each) otherwise.
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<data>
<header>
<nr>00010</nr>
</header>
<item>
<nr>00010</nr>
<value>20</value>
<wight>60</wight>
</item>
<desc>
<nr>00010</nr>
<name>Meet</name>
</desc>
</data>
<data>
<header>
<nr>00102</nr>
</header>
<item>
<nr>00102</nr>
<value>30</value>
<wight>30</wight>
</item>
<desc>
<nr>00102</nr>
<name>Apple</name>
</desc>
</data>
<data>
<header>
<nr>00102</nr>
</header>
<item>
<nr>00102</nr>
<value>30</value>
<wight>40</wight>
</item>
<desc>
<nr>00102</nr>
<name>Apple</name>
</desc>
</data>
</root>
Now if understood your requirement correctly, you need to club all nr together, and also aggregate (sum) their respective values and wight.
The XSLT to achieve that is as follows,
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="nr" match="root/data" use="header/nr"/>
<xsl:template match="/">
<root>
<!-- iterate on each group -->
<xsl:for-each select="root/data[generate-id(.) = generate-id(key('nr', header/nr)[1]) ]">
<xsl:variable name="group" select="key('nr', header/nr)"/>
<xsl:variable name="nr">
<xsl:value-of select="header/nr"/>
</xsl:variable>
<xsl:variable name="name">
<xsl:value-of select="desc/name"/>
</xsl:variable>
<xsl:variable name="value">
<xsl:value-of select="sum($group/item/value)"/>
</xsl:variable>
<xsl:variable name="wight">
<xsl:value-of select="sum($group/item/wight)"/>
</xsl:variable>
<!-- Generate the final XML file -->
<item>
<nr>
<xsl:value-of select="$nr"/>
</nr>
<name>
<xsl:value-of select="$name"/>
</name>
<value>
<xsl:value-of select="$value"/>
</value>
<wight>
<xsl:value-of select="$wight"/>
</wight>
</item>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
Please have a look at my code sample that i have submitted, which speaks of how to handle such a scenario.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples/generic xslt mapping in sap xi, part i.pdf
cheers
Sameer

Similar Messages

  • Complex mapping question (aggregate)

    Hello all,
    For example, i have a xml structure in input :
    <XML Input Structure>
    <Line1>
    <Country> Fr </country>
    <Currency> EUR <Currency>
    <Town> Paris </Town>
    <MT> 10 </MT>
    </Line1>
    <Line2>
    <Country> Fr </country>
    <Currency> EUR <Currency>
    <Town> Paris </Town>
    <MT> 10 </MT>
    </Line2>
    <Line3>
    <Country> USA</country>
    <Currency> DOL <Currency>
    <Town> Chicago </Town>
    <MT> 20 </MT>
    </Line3>
    <Line4>
    <Country> USA</country>
    <Currency> DOL <Currency>
    <Town> Detroit </Town>
    <MT> 20</MT>
    </Line4>
    </XML Input Structure>
    In output, i want to aggregate the field "MT" only  when fields "Country, Currency and Town" are the same in order to have something like that :
    <XML Output Structure>
    <Line1>
    <Country> Fr </country>
    <Currency> EUR <Currency>
    <Town> Paris </Town>
    <MT> 20 </MT>
    </Line1>
    <Line2>
    <Country> USA</country>
    <Currency> DOL <Currency>
    <Town> Chicago </Town>
    <MT> 20 </MT>
    </Line2>
    <Line3>
    <Country> USA</country>
    <Currency> DOL <Currency>
    <Town> Detroit </Town>
    <MT> 20 </MT>
    </Line3>
    </XML Output Structure>
    I am not a specialist in java so i would like to knowi if it's possible to do it with node standard functions ? if not, what is the best solution : XSLT, Java mapping, UDF ?
    Thanks by advance,
    JP
    Edited by: Jean-Philippe PAIN on Dec 16, 2008 12:14 PM

    hi,
    with standard it would be pretty hard
    but with a simple UDF (with 4 inputs) you can aggregate
    and output it quite easily
    try with a udf if you don't want to go for java mapping
    Regards,
    Michal Krawczyk
    http://mypigenie.com XI/PI FAQ

  • Explain a complex mapping in informatica(interview question)

    Hi Deepak, Complex mapping examples I can give you here SCD type 2 can be called as a complex mapping.Doing a mapping through indirect method can be a complex mapping. It depends on your experience. How much experience you are having. Regards,DJ

    explain a complex mapping in informatica(interview question)can any one explan with a complex example  thank you all in advance

  • XI IDoc complex mapping problem - help needed!

    Hi all,
    I am mapping WPUBON IDoc (sent as IDoc XML file) to WPUBON IDoc in R/3. However, I have a complex mapping requirement that I am trying to use the graphical tool for.
    Source segment structure is such that we have:
    E1WPB01 (header) has one or many E1WPB02 (items) and E1WPB05 (coupons).
    E1WPB02 (items) have one or many E1WPB03 (item conditions).
    So for each IDoc, we can have many items (E1WPB02), each item can have many conditions (E1WPB03) and each IDoc can have many coupons (E1WPB05).
    For each E1WPB05 received, we need to take the value and divide it proportionately in order to add an extra E1WPB03 discount condition segment to each E1WPB02 item (we are a retailer and this will allow us to break down customer coupon discounts across each item in the basket). For example, if we have 2 E1WPB02 items with values $2 and $3 and the coupon is worth $1, item 1 needs a new E1WPB03 segment with a value of $0.40 and item 2 needs one with a value of $0.60.
    This process needs to occur for each E1WPB05 segment (customers could have more than one coupon). No E1WPB05 segments are required in the target IDoc.
    I have tried a few things but really am a bit stuck on where to start.... any ideas anyone?
    Thankyou.
    Stuart Richards

    Stefan,
    Here's some sample source XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <WPUBON01>
       <IDOC>
          <EDI_DC40>
             <TABNAM>EDI_DC40</TABNAM>
             <MANDT>104</MANDT>
             <DOCNUM/>
             <DOCREL>620</DOCREL>
             <DIRECT>2</DIRECT>
             <IDOCTYP>WPUBON01</IDOCTYP>
             <MESTYP>WPUBON</MESTYP>
             <MESCOD>ST6</MESCOD>
             <SNDPOR>WPUX</SNDPOR>
             <SNDPRT>KU</SNDPRT>
             <SNDPRN>0799</SNDPRN>
             <RCVPOR>SAPRD1</RCVPOR>
             <RCVPRT>KU</RCVPRT>
             <RCVPRN>0799</RCVPRN>
             <REFINT>00000000000016</REFINT>
          </EDI_DC40>
          <E1WPB01 SEGMENT="1">
             <POSKREIS>0001</POSKREIS>
             <KASSID>1</KASSID>
             <VORGDATUM>20060107</VORGDATUM>
             <VORGZEIT>134512</VORGZEIT>
             <BONNUMMER>120572</BONNUMMER>
             <KASSIERER>4400</KASSIERER>
             <CSHNAME> </CSHNAME>
             <BELEGWAERS>GBP</BELEGWAERS>
             <E1WPB02 SEGMENT="2">
                <VORGANGART/>
                <QUALARTNR>ARTN</QUALARTNR>
                <ARTNR>000005034394436881</ARTNR>
                <VORZEICHEN>-</VORZEICHEN>
                <MENGE>1</MENGE>
                <REFBONNR> </REFBONNR>
                <E1WPB03 SEGMENT="3">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>10.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03>
             </E1WPB02>
             <E1WPB02 SEGMENT="5">
                <VORGANGART/>
                <QUALARTNR>ARTN</QUALARTNR>
                <ARTNR>000005034394471158</ARTNR>
                <VORZEICHEN>-</VORZEICHEN>
                <MENGE>1</MENGE>
                <REFBONNR> </REFBONNR>
                <E1WPB03 SEGMENT="6">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>20.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03>
             </E1WPB02>
             <E1WPB02 SEGMENT="8">
                <VORGANGART/>
                <QUALARTNR>ARTN</QUALARTNR>
                <ARTNR>000005034394469131</ARTNR>
                <VORZEICHEN>-</VORZEICHEN>
                <MENGE>1</MENGE>
                <REFBONNR> </REFBONNR>
                <E1WPB03 SEGMENT="9">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>30.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03>
             </E1WPB02>
             <E1WPB05 SEGMENT="11">
                <VORZEICHEN>+</VORZEICHEN>
                <RABATTART>PTCS</RABATTART>
                <RABVALUE>6.00</RABVALUE>
             </E1WPB05>
             <E1WPB06 SEGMENT="11">
                <VORZEICHEN>+</VORZEICHEN>
                <ZAHLART>PTCS</ZAHLART>
                <SUMME>10.00</SUMME>
                <KARTENNR/>
                <ZUONR>120572</ZUONR>
             </E1WPB06>
          </E1WPB01>
       </IDOC>
    </WPUBON01>
    So we have one coupon worth $6.00. We have 3 items in the basket worth $10, $20 and $30 respectively. The additional E1WPB03 for each will need to contain $1, $2 and $3 respectively to give:
    <?xml version="1.0" encoding="UTF-8"?>
    <WPUBON01>
       <IDOC>
          <EDI_DC40>
             <TABNAM>EDI_DC40</TABNAM>
             <MANDT>104</MANDT>
             <DOCNUM/>
             <DOCREL>620</DOCREL>
             <DIRECT>2</DIRECT>
             <IDOCTYP>WPUBON01</IDOCTYP>
             <MESTYP>WPUBON</MESTYP>
             <MESCOD>ST6</MESCOD>
             <SNDPOR>WPUX</SNDPOR>
             <SNDPRT>KU</SNDPRT>
             <SNDPRN>0799</SNDPRN>
             <RCVPOR>SAPRD1</RCVPOR>
             <RCVPRT>KU</RCVPRT>
             <RCVPRN>0799</RCVPRN>
             <REFINT>00000000000016</REFINT>
          </EDI_DC40>
          <E1WPB01 SEGMENT="1">
             <POSKREIS>0001</POSKREIS>
             <KASSID>1</KASSID>
             <VORGDATUM>20060107</VORGDATUM>
             <VORGZEIT>134512</VORGZEIT>
             <BONNUMMER>120572</BONNUMMER>
             <KASSIERER>4400</KASSIERER>
             <CSHNAME> </CSHNAME>
             <BELEGWAERS>GBP</BELEGWAERS>
             <E1WPB02 SEGMENT="2">
                <VORGANGART/>
                <QUALARTNR>ARTN</QUALARTNR>
                <ARTNR>000005034394436881</ARTNR>
                <VORZEICHEN>-</VORZEICHEN>
                <MENGE>1</MENGE>
                <REFBONNR> </REFBONNR>
                <E1WPB03 SEGMENT="3">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>10.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03>
    <b>           <E1WPB03 SEGMENT="9">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>1.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03></b>
             </E1WPB02>
             <E1WPB02 SEGMENT="5">
                <VORGANGART/>
                <QUALARTNR>ARTN</QUALARTNR>
                <ARTNR>000005034394471158</ARTNR>
                <VORZEICHEN>-</VORZEICHEN>
                <MENGE>1</MENGE>
                <REFBONNR> </REFBONNR>
                <E1WPB03 SEGMENT="6">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>20.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03>
    <b>           <E1WPB03 SEGMENT="9">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>2.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03></b>
             </E1WPB02>
             <E1WPB02 SEGMENT="8">
                <VORGANGART/>
                <QUALARTNR>ARTN</QUALARTNR>
                <ARTNR>000005034394469131</ARTNR>
                <VORZEICHEN>-</VORZEICHEN>
                <MENGE>1</MENGE>
                <REFBONNR> </REFBONNR>
                <E1WPB03 SEGMENT="9">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>30.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03>
    <b>           <E1WPB03 SEGMENT="9">
                   <VORZEICHEN/>
                   <KONDITION>PN10</KONDITION>
                   <KONDVALUE>3.00</KONDVALUE>
                   <CONDID/>
                   <QUALCONDID/>
                </E1WPB03></b>
             </E1WPB02>
             <E1WPB06 SEGMENT="11">
                <VORZEICHEN>+</VORZEICHEN>
                <ZAHLART>PTCS</ZAHLART>
                <SUMME>10.00</SUMME>
                <KARTENNR/>
                <ZUONR>120572</ZUONR>
             </E1WPB06>
          </E1WPB01>
       </IDOC>
    </WPUBON01>
    The 3 new segments required are highlighted in bold. Note that coupon segment can be repeating but is not required in the target message.
    Cheers

  • Complex mapping with deep structure

    Hi all,
    I need to create a complex mapping as follows:
    Source message:
    CreateOrder (0..1)
    -sell-order (0..1)
    --items-sell-order (0..1)
    ---items-sell-request (0..unbounded)
    sell-discount (0..1)
    sell-discount (0..unbounded)
    discount-id (0..1)
    discount-quantity (0..1)
    description (0..1)
    Target message:
    MT_xxxx
    -ORDER_V3 (0..1)
    --TDESC (0..1)
    ---item (0..unbounded)
    ITEM_NUMBER (0..1)
    discount (0..unbounded)
    REASON (0..1)
    VALUE (0..1)
    DESCRIPTION (0..1)
    --TPLUGIN (0..1)
    ---item (0..unbounded)
    ITEM_NUMBER (0..1)
    discount (0..unbounded)
    ID (0..1)
    QUANTITY (0..1)
    The mapping has some rules:
    If sell-order - items-sell-order - items-sell-request - sell-discount - sell-discount - discount-id .length > 0 then the structure TPLUGIN must be filled
    else
      the structure TDESC must be filled
    The problem is: the field ITEM_NUMBER is an index that is unique and must increment each record of node items-sell-request, and it is not mandatory an item to have discounts.
    When I test with n items and all items with discount node, it works perfect. However, if I put for example 10 items in the source array, and for example the records 5 and 6 doesn't have discounts, the association item x discount makes the mapping get lost and mess all the target nodes.
    Could anyone help me?
    Thanks in advance.
    Ricardo.

    Hi Luis,
    An example for source message could be something like:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:CreateOrder>
       <ns0:sell-order>
          <ns1:items-sell-order>
             <ns1:items-sell-request>
                <ns1:sell-discount>
                   <ns1:sell-discount>
                      <ns1:discount-id>1</ns1:discount-id>
                      <ns1:discount-quantity>10</ns1:discount-quantity>
                      <ns1:description>Description1</ns1:description>
                   </ns1:sell-discount>
                <ns1:sell-discount>
                      <ns1:discount-id>2</ns1:discount-id>
                      <ns1:discount-quantity>20</ns1:discount-quantity>
                      <ns1:description>Description2</ns1:description>
                   </ns1:sell-discount>
                </ns1:sell-discount>
             </ns1:items-sell-request>
          <ns1:items-sell-request>
                    *other fields not mentioned here, without sell-discount node*
             </ns1:items-sell-request>
               <ns1:items-sell-request>
                <ns1:sell-discount>
                   <ns1:sell-discount>
                      <ns1:discount-id>A</ns1:discount-id>
                      <ns1:discount-quantity>50</ns1:discount-quantity>
                      <ns1:description>DescriptionA</ns1:description>
                   </ns1:sell-discount>
                   <ns1:sell-discount>
                      <ns1:discount-id>B</ns1:discount-id>
                      <ns1:discount-quantity>100</ns1:discount-quantity>
                      <ns1:description>DescriptionB</ns1:description>
                   </ns1:sell-discount>
                   <ns1:sell-discount>
                      <ns1:discount-id>C</ns1:discount-id>
                      <ns1:discount-quantity>200</ns1:discount-quantity>
                      <ns1:description>DescriptionC</ns1:description>
                   </ns1:sell-discount>
                </ns1:sell-discount>
             </ns1:items-sell-request>
               <ns1:items-sell-request>
                <ns1:sell-discount>
                   <ns1:sell-discount>
                      <ns1:discount-id>I</ns1:discount-id>
                      <ns1:discount-quantity>400</ns1:discount-quantity>
                      <ns1:description>DescriptionI</ns1:description>
                   </ns1:sell-discount>
                   <ns1:sell-discount>
                      <ns1:discount-id>II</ns1:discount-id>
                      <ns1:discount-quantity>500</ns1:discount-quantity>
                      <ns1:description>DescriptionII</ns1:description>
                   </ns1:sell-discount>
                </ns1:sell-discount>
             </ns1:items-sell-request>
          </ns1:items-sell-order>
       </ns0:sell-order>
    </ns0:CreateOrder>
    And an example for target message related to this source is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns2:MT_xxxx">
    <ORDER_V3>
         <TDESC>
              <item>
                   <ITEM_NUMBER>4</ITEM_NUMBER>
                   <discount>
                        <REASON>I</REASON>
                        <VALUE>400</VALUE>
                        <DESCRIPTION>DescriptionI</DESCRIPTION>
                   </discount>
              </item>
         </TDESC>
         <TPLUGIN>
              <item>
                   <ITEM_NUMBER>1</ITEM_NUMBER>
                   <discount>
                        <ID>1</ID>
                        <QUANTITY>10</QUANTITY>
                   </discount>
                   <discount>
                        <ID>2</ID>
                        <QUANTITY>20</QUANTITY>
                   </discount>
              </item>
              <item>
                   <ITEM_NUMBER>3</ITEM_NUMBER>
                   <discount>
                        <ID>A</ID>
                        <QUANTITY>50</QUANTITY>
                   </discount>
                   <discount>
                        <ID>B</ID>
                        <QUANTITY>100</QUANTITY>
                   </discount>
                   <discount>
                        <ID>C</ID>
                        <QUANTITY>200</QUANTITY>
                   </discount>
              </item>
         </TPLUGIN>
    </ORDER_V3>
    </ns2:MT_GerarOrdVd_req>
    Edited by: Ricardo Guedes on Oct 20, 2011 3:03 AM

  • CRMXIF_REL_SAVE_M01 - Mapping Question

    Hello All,
    I have a mapping question, hope some one can answer my question. Please see the link first and the see my question
    http://www.flickr.com/photos/8764045@N06/4265246260/sizes/o/
    I'm mapping the CRM IDOC to the JDBC Call. I have small problem here. All the target fields are Mandatory 1..1 .
    I will explain with an example:
    I have field from source E102BUS_EI_STRUC_TEL_DATA/COUNTRY mapped to target field.
    I used Map With Default so that even if the values are not there frm the source the target field will be mapped with blank.
    But the problem is the parent node for E102BUS_EI_STRUC_TEL_DATA is E102BUS_EI_BUPA_TELEPHONE is 0.999999 , so sometimes that segment is not coming. In this case Map with Default won't work. Map with Default willl work only if the Parent node is present.
    If you ask me to do Exists node function on E102BUS_EI_BUPA_TELEPHONE and then apply Map with Default, then even this won't work.
    Apologize if I confused you guys. Please let me know if you need more clarification.
    Thanks!
    Raj.

    Hi Raj,
    Try to do a mapping like this
    E102BUS_EI_STRUC_TEL_DATA(context E102S_EI_BUPA_TELEPHONE_CON)--mapwithdefault-->then
    E102BUS_EI_BUPA_TELEPHONE-->exists------------------------------------------------------------------>if---->splitbyValue
    let us say this output (the output of splitbyvalue) as 'VALUE'
    VALUE-----------------------------------------------> then
    VALUE|-->count--->greater----------------------->if----->targetField                            
          Constant(0)---->              Constant(blank)-->else
    Regards
    Suraj

  • A top difficulty mapping question

    Hello
    dose anyone can give solution for this mapping question?
    soruce :
    <header>header</header>
    <item>
         <A>a1</A>
         <B>b1</B>
         <C>c1</C>
    </item>
    <item>
         <A>a2</A>
         <B>b2</B>
         <C>c2</C>
    </item>
    <item>
         <A>a3</A>
         <B>b3</B>
         <C>c3</C>
    </item>
    target:
    <header>header</header>
    <item>
         <A>a1,a2,a3  .....</A>
         <B>b1,b2,b3  .....</B>
         <C>c1,c2,c3  .....</C>
    </item>
    The numbers of item is not fixed,it is unbounded.
    so the target line length is not fixed at design time
    welcome any hits,
    Thanks !!
    BR,
    Jeffrey

    Hi,
    Use cache parameter as Context.
    public void add_element(String[] a,ResultList result,Container container)
      //write your code here
    String c = "";
    int i;
    for(i= 0 ; i < a.length; i++)
             c = c + a<i> ;
             if(i != (a.length-1))
                  c = c + ",";
    result.addValue(c);
    A(src)-->removecontext->UDF--->A(tgt)
    B(src)--->removecontext->UDF--->B(tgt)
    C(src)--->removecontext->UDF--->C(tgt)

  • Mapping - Questions

    Hi,
       I have few basic questions regarding mappings.
       1)  I think we can do everything by using Graphical Mapping. Then what is the purpose for Java, XSLT and ABAP mapping? Please give me an example for this...
       2) Which mapping will give better performance? Is there any comparison document available in SDN?
      Appreciate your help!
    Thanks,
    Vivek

    hi,
    Mapping Techniques
    XI provides 3 standard ways of interface mapping between source and target.
    Graphical mapping
    Java Mapping
    XSLT Mapping
    Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
    ABAP mapping
    XSLT mapping with ABAP Extensions
    Graphical Mapping
    Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
    ABAP Mapping
    A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
    Java Mapping
    Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
    SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
    XSLT Mapping
    One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
    check these links too..
    Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/b78d406b305537e10000000a1550b0/frameset.htm
    For Java Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    For XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    Error handling in XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/8a/7672f7d7e444439fd7024f806221a4/frameset.htm
    You can also refer some How to guides:
    XI New Mapping Features article,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi%203.0%20new%20mapping%20features%20article.evn
    Generic XSLT Mapping and Sample Code,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi%20code%20samples/generic%20xslt%20mapping%20and%20sample%20code.pdf
    How to use ABAP-MApping in XI3.0,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
    Thanks,
    Vijaya.

  • Many-to-many mapping question

    Hi,
    I'm working with two classes Car and Customer. The Car class has a Vector of Customers and the Customer class has a Vector of Car. Both are related by a many to many mapping.
    I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

    Hello Vladislav, I understand your first question in this thread, but I'm not sure I follow the rest, so let me respond to your first post:
    "I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?"
    The issue here is that with a Many to Many mapping the mapping is responsible for writing to the association table. So, you have a "CAR_CUST" association table. Imagine you add a Car "101" to a customer "501" and the requisite customer "501" to that car "101" in your object model. Then the association table should only be updated once, with an entry of "101, 501". But since the M-M is mapped in both directions, you need to tell TopLink which of these to consider as the "master" when updating the database.
    If you didn't make one of the M-M mappings "read only", then TopLink would insert "101, 501" twice in the association table, and then at a later date you would see that the customer 501 had two 101 cars!
    We do have a feature that allows for TopLink to maintain bidirectional relationships such that if you add or remove a target from one relationship, TopLink will automatically add/remove it from the opposite direction. In my opinion this is lazy programming! A good Java developer should insist on keeping his model up to date on his own. This feature was added because it's part of the EJB spec, not necessarily because it's a good idea ;)
    - Don
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

  • Mapping question

    Hello,
    I have a rather simple question regarding a mapping.
    Lets say my input message is as following:
    <mes1>
       <seg1>
          <name1>Peter</name1>
          <street1>HighCrt</street1>
       </seg1>
       <seg2>
          <name2>Vlad</name2>
          <sub2>Trickst</sub2>
       </seg2>
       <seg2>
          <name2>Rinaldo</name2>
          <sub2>fiave</sub2>
       </seg2>
    </mes1>
    My output should be:
    <out>
       <put>
          <name>Peter</name>
          <name>Vlad</name>
          <name>Rinaldo</name>
       </put>
    </out>
    So my output field "name" should created in case I have a "name1" field in the source message and additionally it should be created for every "seg2" element that is present in the source message and it should be filled with the value of "name2".
    How can I in the mapping trigger that the "name" element of the output message will be generated for each of the two described elements of the source message?
    Best Regards,
    Peter

    Hi,
    Could be possible using user defined function.
    Create a user defined Function with  cache = context
    public void createNodeName(String[] a,String[] b,ResultList result,Container container){
    if ( a.length > 0 )
      result.addValue ( a[0] ) ;
    for ( int i = 0; i < b.length; i++ )
         result.addValue ( b<i> );
    in Mapping use
    1. name1 as first argument
    2. name2 with removeContext as second argument

  • ABAP Mapping Questions

    Hi,
    I am trying to get my head around ABAP mappings and have a few questions.
    In the below code sample which I find in every example and blog it talks about specific steps -
    *initialize iXML, * create iXML factory object, * create streamfactory object, * create input stream object, * initialize the input xml document, * parse the input xml document
    In these steps the code is always exactly the same so my question is are these just standard steps that are implemented every single time an abap mapping is used and hence only standard lines that never have to be changed or will they be different depending on the mapping.
    I am trying to work out where I will begin my coding.
    So would somebody be so kind as to give me a brief explanation of the above mentioned steps.
    Thank you
    METHOD if_mapping~execute.
    * initialize iXML
      TYPE-POOLS: ixml.
      CLASS cl_ixml DEFINITION LOAD.
    * create iXML factory object
      DATA: ixmlfactory TYPE REF TO if_ixml.
      ixmlfactory = cl_ixml=>create( ).
    * create streamfactory object
      DATA: streamfactory TYPE REF TO
      if_ixml_stream_factory.
      streamfactory = ixmlfactory->create_stream_factory( ).
    * create input stream object
      DATA: istream TYPE REF TO if_ixml_istream.
      istream = streamfactory->create_istream_xstring( source ).
    * initialize the input xml document
      DATA: idocument TYPE REF TO if_ixml_document.
      idocument = ixmlfactory->create_document( ).
    * parse the input xml document
      DATA: iparser TYPE REF TO if_ixml_parser.
      iparser = ixmlfactory->create_parser(
      stream_factory = streamfactory
      istream = istream
      document = idocument ).
      iparser->parse( ).

    Hi,
         The above lines you mentioned deal with initialization of the iXML parser for parsing through the XML payload, so they would remain the same for all mapping where you are parsing the input payload.
    The coding for you specific mapping will begin after this, something like :
    * Implements the DOM generating interface to the parser
      iparser->parse( ).
      emp_node_collection = idocument->get_elements_by_tag_name_ns( name = 'Order' ).
      emp_node_length = emp_node_collection->get_length( ).
      emp_node_iterator = emp_node_collection->create_iterator( ).
    where you start reading the xml node values.
    Hope this helps.
    Regards

  • One to one mapping question -- can I just map a lookup field for queries?

    I have a table with a state code. I'd like to have a "virtual lookup" on the java class to a region table. I.e., this java class "studies" has a state code. I can map a one-to-one to the descriptor class that has the ref table, but I'd like to have a property in the java class pre-mapped to the "region" field in this lookup so for querying i can just use:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(study.class);
    q.setSelectionCriteria(new ExpressionBuilder().get("Region").equal(Region));
    to get all the studies for a particular region.
    am I going about this wrong? or do I have to get the reference table descriptor fromt he one to one map and do something different?

    well,on the way home last nite, I realized I'd had a complete brain fart. I've done this before. I just set up a 1-1 map between descriptors and then built the query like this:
    q.setSelectionCriteria(new ExpressionBuilder().get("refFPO").get("FPO_NO").equal(FPO));
    You can get the pointer to the "refFPO" which is the the descriptor mapped 1-1, then appended the column you wish to get.
    I still went ahead and amended my class to include a read-only, non-toplink mapped attribute "FPO" which just gets the reference variable pointing to "refFPO.getFPO_NO();
    I answered my own question just in case anyone wondered ....

  • 1-1 mapping question

    I am trying to post the question in a different way. My previous post on the related subject can be found at Re: 1-1 mapping
    Two entities, Parent and Child, where a Parent has a Child (privately owned) or zero Child.
    In object model, Parent has an attribute child; Child does not have a parent attribute.
    Two tables, Parent and Child, with constraint where a child record cannot exist without its parent record (i.e. Child table has a foreign key to the Parent table).
    Class Parent and Child are mapped to table Parent and Child respectively.
    How do we define the 1-1 mapping in the Mapping Workbench so that Parent and Child can be inserted into the tables in one unif of work?
    Any comment or help would be greatly appreciated.
    Haiwei

    You can't do this as you described. You must have and map a relationship from child to parent in order to be able to map the 1-1 from parent to child (since your foreign key is in the child table).
    - Don

  • Port mapping question - I need clarification

    I have posted a question about port mapping previously but - although I thought I understood - it is still not working for me. I was hoping there was a kind soul out there who could humor me and explain port mapping with AEBS 802.11n as if there where talking to a 5 year old.
    Thanks for the help and it's ok to laugh.

    {quote:}This address MUST be outside of the range of IP addresses that your 802.11n AirPort Extreme Base Station's (AEBS) DHCP service is providing.{quote}
    This actually is incorrect.
    The statement that the mapped internal address must be static is correct; otherwise the AEBS will not, if the Mac is assigned a different dynamic (DHCP) IP address by the AEBS some time in the future, be able to forward packets to the Mac. However it is very straightforward to have the Mac computer be assigned an address dynamically by the AEBS and to have the AEBS always assign the same IP address to the same Mac computer. Thereby giving the Mac a static address inside the DHCP range.
    In the AirPort utility go to Internet | DHCP | DHCP Reservations. Click "+" then enter the MAC (what Apple calls Ethernet ID if you are using wired or AirPort ID if wireless) hardware address of the Mac computer, give it an IP address, save it. Then that Mac computer will always receive that (static) IP address from the AEBS.
    Why do this? Well by continuing to use DHCP (while having though a static IP address) you keep all the other benefits of DHCP such as automatically having the gateway address, the DNS server addresses given to the Mac. Otherwise you have to enter all this information manually on the computer if you put it outside the DHCP address range. This is very desirable, especially for most home users, as their DNS server entries are provided by their ASP and picked up by the AEBS. If the ASP changes DNS addresses the manually configured Mac machine will not know.
    So in summary - for port forwarding it is NOT necessary for the Mac machine to be outside the DHCP range, in fact _it is desirable to keep it in the DHCP range_ *as long as* the Mac utilises DHCP reservation on the AEBS.
    I have tested this and it works fine.

  • XI mapping question

    Hello,
    I have a situation that I need to run Z-BAPI function before starting mapping in XI. Let me explain scenario with more information.
    1. I need to update a order in the SAP. The order may or may not exists in the SAP.
    2. We have a Z-BAPI function that checks if Order exists in the SAP.
    3. The mapping shall takes place upon sucessfully finding the Order in the SAP. Incase no Order found, mapping should not be done.
    4. The sender sends multiple orders at same time and incase if an order was not in SAP, Mapping should not takes place and move on to next order.
    Now my question is what/how exactly I need to do to avaoid mapping incase an Order has not found and move on to next order in the queue.
    Please let me know.
    Thank you,
    Balaji

    Balaji,
    Just for understanding....
    You are interested in generating outputs only for Order exist  in R/3 system..right?
    I mean do not want to generate XI output in case order do not exist but at the same time it will generate output for remaining orders which exist in the R/3 system..right?
    If so...mean you are not interested whether it runs mapping or not..
    In this case using graphical mapping you can check if order exist in R/3 system( In UDF you can call your ZBAPI to check ) and base on the output of your function module you can decide whether to generate header node or not...
    Let me know if you need more details.
    Nilesh

Maybe you are looking for

  • Error with dbms_redefinition package?

    Hi everybody! I have a table 'object_log'(it is partioned) . I used dbms_redefinition to change its partion , and evrythink was ok. When I tried to redefine this table for the second time it failed! I run this script BEGIN DBMS_REDEFINITION.start_red

  • Raising exceptions in function module

    I am writing a coding inside the userexit. The call customer function has 'exception' parameters like below:          EXCEPTIONS            IDOC_ERROR          = 1            DO_NOT_PROCESS_IDOC = 2            OTHERS              = 3. Now, I want to

  • In MSS, Other than Manager to access the employee in the Org Unit

    Hi all, IN our current project, for MSS, Head of the Org Unit (A/B 012) triggers the Personnel Change request, First Level Approver (HR-Partner from Custom Infotype) approves the PCR and Admin process the PCR. Now the requirement is changed... HR-Par

  • IPOD Software Updater- "Restore" not working

    The IPOD software updater will not allow me to restore my Nano. Both the update and restore buttons are not "active". The updater prompts me to plug in my Nano and automatically attempts to update my Nano which isn't necessary since there's no new up

  • Application Server on Windows 2003 - 32bit / 64bit queries

    Hi We have a 10g forms application that we wish to deploy on 64bit AMD opteron architecture machines. We need to deploy on Windows 2003 Server. From Metalink, I understand that Infrastructure Installation is not supported on the 64bit version of Wind