I’m trying to create an XLS file to transform the output of my first software into the input of my second one.
This is the format I get :
<entities actor="TXXXXX" timezone="Europe/Paris" messageId="771760c9-d24a-46dc-847a-6aef30c84c49" currencyCode="EUR" exchangeInterface="SAP_TEST">
<item id="190b41fda74-233f" code="M-016738">
<item_code>M-016738</item_code>
<item_unit>PCE</item_unit>
<item_description>Test SAP mass creation 1</item_description>
<item_registered>false</item_registered>
</item>
<item id="190b41fda74-233g" code="M-016739">
<item_code>M-016739</item_code>
<item_unit>PCE</item_unit>
<item_description>Test SAP mass creation 2</item_description>
<item_registered>true</item_registered>
</item>
</entities>
The format I want :
<MATMAS_BAPI03>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>230</MANDT>
<DOCNUM>0000000039534114</DOCNUM>
</EDI_DC40>
<E1BPMATHEAD SEGMENT="1">
<IND_SECTOR>M</IND_SECTOR>
<MATL_TYPE>ERSA</MATL_TYPE> //if item_registered is true
<BASIC_VIEW>X</BASIC_VIEW>
<MATL_DESC>Test SAP mass creation</MATL_DESC>
<OLD_MAT_NO>M-016738</OLD_MAT_NO>
</E1BPMATHEAD>
</IDOC>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>230</MANDT>
<DOCNUM>0000000039534114</DOCNUM>
</EDI_DC40>
<E1BPMATHEAD SEGMENT="1">
<IND_SECTOR>M</IND_SECTOR>
<MATL_TYPE>HIBE</MATL_TYPE> //if item_registered is false
<BASIC_VIEW>X</BASIC_VIEW>
<MATL_DESC>Test SAP mass creation 2</MATL_DESC>
<OLD_MAT_NO>M-016739</OLD_MAT_NO>
</E1BPMATHEAD>
</IDOC>
I’ve tried to make an XLS file with an incrementation
<MATMAS_BAPI03>
<xsl:variable name="increment" select = "'0'"/>
<xsl:for-each select="/entities/item">
<xsl:value-of select="count(/entities/item)"></xsl:value-of>
<xsl:text>
</xsl:text>
<IDOC>
To get the value of each attibute :
<xsl:value-of select="/entities/item[$increment]/item_purchaseType/@code"/>
My problem is it only gets the value for one item_code.
Can anyone enlight me?
New contributor
Skyhald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2