on 08-15-2007 11:17 AM
Small question,
IS it posiible and how to interprate a single line in a message and repeat that line 3 times
Please see below.
<item>
<No>10</No>
<Currency>EUR</Currency>
<PriceInVAT>119,00</PriceInVAT>
<PriceExVAT>100,00</PriceExVAT>
<VATamount>19,00</VATamount>
</item>
I want to convert this to 3 different lines in the output
1:
No: 10
PriceInclVat 119,00
2:
No: 10
PriceExclVat 100,00
2:
No: 10
VatAmount 19,00
Can someone help me with this.
Thanks,
Hi Patrick,
Can you please confirm me that whether do you have the following the target structure
No
Value -- Here it can store any value 3 values of the source
If this is the case then just duplicate the target strucutre 2 times and map the
no-no 3 times and
PriceInVAT->Value,
PriceExVAT->Value,
VATamount>->Value for each occurence of target node
So then your requirement will fulfill
If this is the not satisfy the answer give me some more details about your target structure.
Warm Regards,
Vijay
Message was edited by:
Gangisetty Vijaya Bhaskarudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for that, here is the example of how it should look like in the end
Source
<head>
<ordNO>0001</ordNO>
<date>12122007</date>
</head>
<item>
<No>10</No>
<Currency>EUR</Currency>
<PriceInVAT>119,00</PriceInVAT>
<PriceExVAT>100,00</PriceExVAT>
<VATamount>19,00</VATamount>
</item>
<item>
<No>20</No>
<Currency>EUR</Currency>
<PriceInVAT>238,00</PriceInVAT>
<PriceExVAT>200,00</PriceExVAT>
<VATamount>38,00</VATamount>
</item>
Target
<head>
<ordNO>0001</ordNO>
<date>12122007</date>
</head>
<item>
<No>10</No>
<Currency>EUR</Currency>
<PriceInVAT>119,00</PriceInVAT>
</item>
<item>
<No>10</No>
<Currency>EUR</Currency>
<PriceExVAT>100,00</PriceExVAT>
</item>
<item>
<No>10</No>
<Currency>EUR</Currency>
<VATamount>19,00</VATamount>
</item>
<item>
<No>20</No>
<Currency>EUR</Currency>
<PriceInVAT>238,00</PriceInVAT>
</item>
<item>
<No>20</No>
<Currency>EUR</Currency>
<PriceExVAT>200,00</PriceExVAT>
</item>
<item>
<No>20</No>
<Currency>EUR</Currency><VATamount>38,00</VATamount>
</item>
So for each item which is send in i need to conver it to 2 or 3 different itemlines. This has to do with wholesale and consumer orders.
Greets
This can be done with the 'UseOneAsMany' function.
http://help.sap.com/saphelp_nw70/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/content.htm
Thanks for this reply but isn't it so that this function looks at identical element names.
and in our requirement the only thing reused is the lineItem number. OK and the Currency at the moment but this also can be put in the header.
as i can remember correctly the function useOneAsMany only works if you have repeating element names which are identical
<no>10</no>
<Price>119</Price>
<Price>100</Price>
<Price>19</Price>
My element names differ from each other, i'll try but i don't think this is it.
GReets
Hi Patrick,
You first duplicate your Item 2 times in Target side so you will have 3 items in the target. According to your target strucutre , you have 3 fields in the Item <PriceInVAT>, <PriceExVAT>, <VATamount>. Right??
In the first target item map like as below
<item>
<No>10</No>
<Currency>EUR</Currency>
<PriceInVAT>119,00</PriceInVAT>
</item>
In the Second target item map like as below
<item>
<No>10</No>
<Currency>EUR</Currency>
<PriceExVAT>100,00</PriceExVAT>
</item>
<item>
In the third target item map like as below
<No>10</No>
<Currency>EUR</Currency>
<VATamount>19,00</VATamount>
</item>
<item>
I hope this is clearn for you.
Warm Regards,
Vijay
Warm Regards,
Vijay
If possible i can also do this
<b>Source</b>
<item>
<No>10</No>
<Currency>EUR</Currency>
<PriceInVAT>119,00</PriceInVAT>
<PriceExVAT>100,00</PriceExVAT>
<VATamount>19,00</VATamount>
</item>
<b>Target</b>
<item>
<No>10</No>
<OrderType>0001</OrderType>
<Price>119,00</Price>
</Item>
<item>
<No>10</No>
<OrderType>0002</OrderType>
<Price>119,00</Price>
</Item>
<item>
<No>10</No>
<OrderType>0003</OrderType>
<Price>119,00</Price>
</Item>
And the <b>OrderType </b>Element may be hardCoded (0001 inclVAT, 0002 exclVAT, 0003 VAT).
Vijaya,
That makes sense yes BUT i see an issue here. WE make use of a BAPI in the end, and this means i have to make at minimum 2 message mappings. Because if the end structure only provides 1 item element node (1..n) i have to duplicate these which will ensure to interfear with SAP Standard correct ?
Hi Patrick,
If you duplicate the tree , then there is no problem because it will consider as one occurence of item only. So you don't have the problem with BAPI end.
U r just producing the 3 items for each item in the source. Nothing is changing. I hope there is no problem whie duplicating the subtree.
Warm Regards,
Vijay
If order is not an issue, message mapping with duplicate subtrees will do alright.
If order is an issue (and since message mapping will generate target not in order), use XSLT if your scenario allows (not too many source items), since handling order in message mapping can be a real pain in the @$$.
Simple XSLT to solve it:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="item">
<xsl:copy>
<xsl:apply-templates select="@*|node()[not(self::PriceExVAT) and not(self::VATamount)]"/>
</xsl:copy>
<xsl:copy>
<xsl:apply-templates select="@*|node()[not(self::PriceInVAT) and not(self::VATamount)]"/>
</xsl:copy>
<xsl:copy>
<xsl:apply-templates select="@*|node()[not(self::PriceInVAT) and not(self::PriceExVAT)]"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Regards,
Henrique.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.