cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT mapping issue for data type enhancement field

madhusudana_reddy2
Contributor
0 Kudos

Hi All,

I am trying to create xslt mapping for some requirement. I have enhanced standard SAP structure at source side and added few Z fields. When trying to populate data at target side using <xsl:value-of >,  zfield data is not populating at target side. Source side Zfield path is showing as given below, when i try to copy path of source node...

/ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZCondition

When using <xsl:value-of select="ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/> --------> it is not generating any output at target side...

Can any body know how to populate this ZCondition field value at target side.

Regards, Madhu

Accepted Solutions (0)

Answers (3)

Answers (3)

madhusudana_reddy2
Contributor
0 Kudos

Hello All,

For better understanding I am giving sample xml structure below.. My requirement is just to read the value of ZShippingCondition field in xslt mapping.

<?xml version="1.0" encoding="UTF-8"?>

   <ns0:PurchaseOrderConfirmation xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global">-

   <MessageHeader>

   <CityName>CITY</CityName>

   <AdditionalCityName/><DistrictName/>

   <POBoxID>PO BOX</POBoxID>

   </MessageHeader>

   <PurchaseOrder>

   <ID schemeAgencySchemeAgencyID="" schemeAgencyID="" schemeID="">PO Number</ID>

   <OrganisationFormattedName>Name1</OrganisationFormattedName>

   <ns1:ZShippingCondition xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation"> Shipping value </ns1:ZShippingCondition>

   <ns1:ZHeaderText xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation"> Header Text value </ns1:ZHeaderText>

   </PurchaseOrder>

   </ns0:PurchaseOrderConfirmation>

I tried to read value of ZShippingCondition in following 6 ways..without success.

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"  exclude-result-prefixes="ns0 ns1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:ns1="http://sap.com/xi/XI/Mail/30">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<Structure>

<ZShippingCondition><xsl:value-of select="ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/></ZShippingCondition>

<ZShippingCondition><xsl:value-of select="//ns1:ZShippingCondition"/></ZShippingCondition>

<ZShippingCondition><xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns0:ZShippingCondition"/></ZShippingCondition>

<ZShippingCondition><xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/></ZShippingCondition>

<ZShippingCondition></ZShippingCondition>

<ZShippingConditon> <xsl:copy>

               <xsl:apply-templates select="//ns1:ZShippingCondition"/>

            </xsl:copy></ZShippingConditon>

</Structure>

</xsl:template>

</xsl:stylesheet>


Regards, Madhu

Former Member
0 Kudos

Hello,

Replace this line xmlns:ns1="http://sap.com/xi/XI/Mail/30"

with xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation"

So ur xslt should be kie this -

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"  exclude-result-prefixes="ns0 ns1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<Structure>

<ZShippingCondition><xsl:value-of select="ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/></ZShippingCondition>

</Structure>

</xsl:template>

</xsl:stylesheet>

Thanks

Amit Srivastava

madhusudana_reddy2
Contributor
0 Kudos

Hi Amit,

When we change namespace in xslt mapping, receiver mail adapter will throw error. Because Receiver mail adapter will always expects http://sap.com/xi/XI/Mail/30 as namespace.

Error in Receiver Mail adapter as given below::::

expecting start tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {http://bio-rad.com/OTC/PurchaseOrderConfirmation}Mail

Now I need to check how to change the namespace...from http://bio-rad.com/OTC/PurchaseOrderConfirmation  to http://sap.com/xi/XI/Mail/30

Regards,

Madhu

azharshaikh
Active Contributor
0 Kudos

Hi Madhu,

I tried with this XSLT and its giving the Output as expected. Please check.

XSL:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"  exclude-result-prefixes="ns0 ns1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:ns1="http://sap.com/xi/XI/Mail/30">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<xsl:element name="Structure">

<xsl:value-of select="//*[local-name() = 'ZShippingCondition']" />

</xsl:element>

</xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?>
<Structure>Shipping value</Structure>

iaki_vila
Active Contributor
0 Kudos

Hi Madhusudana Reddy,

Are you sure is not generated?, have you checked it in the Operation Mapping?.

It could be a cache issue, if you see the tag generated in the OM, try to refresh the CPA cache. If the tag is not generated in the OM try to check the namespaces in the XPATH as Azhar pointed out.

Regards.

madhusudana_reddy2
Contributor
0 Kudos

It is not cache issue. I am directly testing in XMLSpy, still no value is generating at target side xml.

Regards,

azharshaikh
Active Contributor
0 Kudos

Hi Madhu,

Try with following code and check:

<xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns0:ZShippingCondition" />

OR

<xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition" />

Regards,

Azhar

madhusudana_reddy2
Contributor
0 Kudos

Both of your alternatives not working.

Any body have idea...why field is not populating at target side....