06-28-2011 4:37 AM
Hello,
I am getting error ABAP XML formatting error in XML node of type "element", name: "abap" using my XSLT program.
Here is the XML response (SOURCE) as string.
b60##<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:execResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://webservice.hostname.com/"><execReturn xsi:type="xsd:string"><?xml version="1.0" encoding="Shift_JIS" ?><Report><Header><system>ABCWEB</system><dataType>ABCDEFGHIJ</dataType><sendType>response</sendType></Header><Body><SequenceNo>1234567890</SequenceNo><InquiryFactory>ABC</InquiryFactory><ProcessingID></ProcessingID><ProcessingDate>1234567890</ProcessingDate><KeyNo>ABCDEFGHIJ</KeyNo><ProcessingClassify>S</ProcessingClassify><Product>ABCDEFGHIJ</Product><ResponseClassify>0</ResponseClassify><OrderInformation-List><OrderInquiry><TransferNo>1234567890</TransferNo><TransferLineNo>000010</TransferLineNo><CustomerOrderNo>ABCDEFGHIJ</CustomerOrderNo><CustomerOrderLineNo> </CustomerOrderLineNo><ShipInstructionNo>1234567890</ShipInstructionNo><DropUnitPrice>1234567890</DropUnitPrice><Qty>200</Qty><Amount>6000</Amount><WBSNo> </WBSNo><SpecPartNo>ABCDEFGHIJ</SpecPartNo></OrderInquiry></OrderInformation-List><SalesOrderPartNo>ABCDEFGHIJ</SalesOrderPartNo><CatalogPartNo></CatalogPartNo><AgentPartNo>1234567890</AgentPartNo><CustomerPartNo></CustomerPartNo><R3CompanyCD>1000</R3CompanyCD><OrderPlacingCompanyCD>R110011</OrderPlacingCompanyCD><ShipToCD>1234567890</ShipToCD><ShipToCompanyName>SINGAPORE</ShipToCompanyName><ShipToAddress1>ABCDEFGHIJ</ShipToAddress1><ShipToAddress2>ABCDEFGHIJ</ShipToAddress2><ShipToAddress3>SINGSAPORE</ShipToAddress3><ShipToAddress4></ShipToAddress4><ULPort>ABCDEFGHIJ</ULPort><DropCurrency>EUR</DropCurrency><DeliveryAirport>SINGAPORE</DeliveryAirport><DropMethod></DropMethod><SCMCustomer>EA07000442</SCMCustomer><RealShipToCd></RealShipToCd><SOCurrency></SOCurrency><SOPayterm></SOPayterm><LogisticCategory>0</LogisticCategory><SOOrderNo></SOOrderNo><MaterialKeyA1>1234567890</MaterialKeyA1></Body></Report></execReturn></ns1:execResponse></soapenv:Body></soapenv:Envelope>##0####
The above is the result after adding the following modifications in ABAP.
REPLACE ALL OCCURRENCES OF
'<' IN wf_string1 WITH '<' .
REPLACE ALL OCCURRENCES OF
'>' IN wf_string1 WITH '>' .
REPLACE ALL OCCURRENCES OF
'"' IN wf_string1 WITH '"'
I would like to display the result starting from <BODY> as table as shown below.
SequenceNo 1234567890
InquiryFactory ABC
ProcessingID
ProcessingDate 1234567890
and so on.
I am using the the same ABAP/XSLT program following example /people/durairaj.athavanraja/blog/2004/09/20/consuming-web-service-from-abap
Please let me know what I did wrong.
Tony
06-29-2011 1:52 PM
The transformation itself could be used to convert XML to ABAP.
Try something like this.
CALL TRANSFORMATION your_transformation_name
SOURCE XML l_xml_string
RESULT protocol_version = l_prot_version
check_id = l_check_id
message_id = l_msg_id
message_text = l_msg_text
t_arguments = lt_arguments
creator = l_creator.
Edited by: Sandeep S on Jun 29, 2011 6:22 PM
06-30-2011 3:46 AM
I have no idea why this is showing like this, but please bear with me. I tried every way I can to make my reply readable but the text editor is keeping on doing this. So here it goes.
Hi Sandeep,
I tried to debug the CALL transformation. I am getting CX_XSLT_FORMAT_ERROR and when I run the whole program this is the error message "ABAP XML formatting error in XML node of type "element", name: "abap"
Here is my XLST program for the response above.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
<xsl:template match="NewDataSet">
<OUTTAB>
<xsl:for-each select="Table">
<OUTTAB1>
<report>
<header>
<system>
<xsl:value-of select="system"/>
</system>
<dataType>
<xsl:value-of select="dataType"/>
</dataType>
<sendType>
<xsl:value-of select="sendType"/>
</sendType>
</header>
<body>
<SequenceNo>
<xsl:value-of select="SequenceNo"/>
</SequenceNo>
<InquiryFactory>
<xsl:value-of select="InquiryFactory"/>
</InquiryFactory>
<ProcessingID>
<xsl:value-of select="ProcessingID"/>
</ProcessingID>
<ProcessingDate>
<xsl:value-of select="ProcessingDate"/>
</ProcessingDate>
<KeyNo>
<xsl:value-of select="KeyNo"/>
</KeyNo>
<ProcessingClassify>
<xsl:value-of select="ProcessingClassify"/>
</ProcessingClassify>
<Product>
<xsl:value-of select="Product"/>
</Product>
<ResponseClassify>
<xsl:value-of select="ResponseClassify"/>
</ResponseClassify>
<OrderInformation-List>
<OrderInquiry>
<TransferNo>
<xsl:value-of select="TransferNo"/>
</TransferNo>
<TransferLineNo>
<xsl:value-of select="TransferLineNo"/>
</TransferLineNo>
<CustomerOrderNo>
<xsl:value-of select="CustomerOrderNo"/>
</CustomerOrderNo>
<CustomerOrderLineNo>
<xsl:value-of select="CustomerOrderLineNo"/>
</CustomerOrderLineNo>
<ShipInstructionNo>
<xsl:value-of select="ShipInstructionNo"/>
</ShipInstructionNo>
<DropUnitPrice>
<xsl:value-of select="DropUnitPrice"/>
</DropUnitPrice>
<Qty>
<xsl:value-of select="Qty"/>
</Qty>
<Amount>
<xsl:value-of select="Amount"/>
</Amount>
<WBSNo>
<xsl:value-of select="WBSNo"/>
</WBSNo>
<SpecPartNo>
<xsl:value-of select="SpecPartNo"/>
</SpecPartNo>
</OrderInquiry>
</OrderInformation-List>
<SalesOrderPartNo>
<xsl:value-of select="SalesOrderPartNo"/>
</SalesOrderPartNo>
<CatalogPartNo>
<xsl:value-of select="CatalogPartNo"/>
</CatalogPartNo>
<AgentPartNo>
<xsl:value-of select="AgentPartNo"/>
</AgentPartNo>
<CustomerPartNo>
<xsl:value-of select="CustomerPartNo"/>
</CustomerPartNo>
<R3CompanyCD>
<xsl:value-of select="R3CompanyCD"/>
</R3CompanyCD>
<OrderPlacingCompanyCD>
<xsl:value-of select="OrderPlacingCompanyCD"/>
</OrderPlacingCompanyCD>
<ShipToCD>
<xsl:value-of select="ShipToCD"/>
</ShipToCD>
<ShipToCompanyName>
<xsl:value-of select="ShipToCompanyName"/>
</ShipToCompanyName>
<ShipToAddress1>
<xsl:value-of select="ShipToAddress1"/>
</ShipToAddress1>
<ShipToAddress2>
<xsl:value-of select="ShipToAddress2"/>
</ShipToAddress2>
<ShipToAddress3>
<xsl:value-of select="ShipToAddress3"/>
</ShipToAddress3>
<ShipToAddress4>
<xsl:value-of select="ShipToAddress4"/>
</ShipToAddress4>
<ULPort>
<xsl:value-of select="ULPort"/>
</ULPort>
<DropCurrency>
<xsl:value-of select="DropCurrency"/>
</DropCurrency>
<DeliveryAirport>
<xsl:value-of select="DeliveryAirport"/>
</DeliveryAirport>
<DropMethod>
<xsl:value-of select="DropMethod"/>
</DropMethod>
<SCMCustomer>
<xsl:value-of select="SCMCustomer"/>
</SCMCustomer>
<RealShipToCd>
<xsl:value-of select="RealShipToCd"/>
</RealShipToCd>
<SOCurrency>
<xsl:value-of select="SOCurrency"/>
</SOCurrency>
<SOPayterm>
<xsl:value-of select="SOPayterm"/>
</SOPayterm>
<LogisticCategory>
<xsl:value-of select="LogisticCategory"/>
</LogisticCategory>
<SOOrderNo>
<xsl:value-of select="SOOrderNo"/>
</SOOrderNo>
<MaterialKeyA1>
<xsl:value-of select="MaterialKeyA1"/>
</MaterialKeyA1>
</body>
</report>
</OUTTAB1>
</xsl:for-each>
</OUTTAB>
</xsl:template>
</xsl:stylesheet>
Also I noticed that the actual response has two version header. Would it matter? Do I need to crop this out from the actual XML response before transformation. My OUTTAB is still empty.
*<?xml version="1.0" encoding="utf-8"?>*<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:execResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://webservice.hostname.com/"><execReturn xsi:type="xsd:string">*<?xml version="1.0" encoding="Shift_JIS" ?>*<Report><Header><system>
Please advise. Thank you.
Tony
06-30-2011 7:15 AM
Just realize that the output of my XSLT when I tst it with "output to string" is another XML. I tried Simple Transformation but getting internal error. Somehow our R3 4.7 does not have Simple Transformation as checked from SE80 (viewing TAG LIBRARY) is there a way to convert XSLT to Simple Transformation?