2007 Mar 08 12:29 AM
Hi Experts,
I am currently trying to convert this xml file back to my ABAP structure but i have been unsuccessful so far. In XML file contain more than 1 reocrd. But my XSLT program is retriving only only first record. Try to help to get all the records.
Sample XML File:
.
Thanks for your help in advance.
Regards,
Srini
______________________________ ______________________________
2007 Mar 09 4:22 PM
Hi Raja,
Here is the Structure Details:
FINAL_RESULT CHAR220 CHAR 220 0 Text: Length 220
Regards,
Srini
2007 Mar 08 8:13 AM
use the following changed xslt
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hp="http://www.openuri.org/" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<OUTTAB>
<xsl:for-each select="soap:Envelope/soap:Body/hp:matchResponse/matchResult">
<ZTEST11>
<FINAL_RESULT>
<xsl:value-of select="String"/>
</FINAL_RESULT>
</ZTEST11>
</xsl:for-each>
</OUTTAB>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>Regards
Raja
2007 Mar 08 7:56 PM
Hi Raja,
Thanks for your help.
I made the changes suggested by you, still i am getting only one record in the output.
here is the output i am getting:
<?xml version="1.0" encoding="utf-16"?>#<asx:abap xmlns:asx=
"http://www.sap.com/abapxml" xmlns:hp="http://www.openuri.org/" xmlns:soap=
"http://schemas.xmlsoap.org/soap/envelope/" version="1.0"><asx:values>
<OUTTAB><ZTEST11><FINAL_RESULT>23901 EUS 20060625 ABU NIDAL
ORGANISATION XX ALL 20060529 20880808</FINAL_RESULT></ZTEST11>
</OUTTAB></asx:values></asx:abap>
Hope you understand. Could you please guide me to resolve this issue.
please let me know, if you need any other info from my end.
Regards,
Srini
2007 Mar 09 9:48 AM
can you give me the structure of ZTEST11
(fields and its definition)
raja
2007 Mar 09 4:22 PM
Hi Raja,
Here is the Structure Details:
FINAL_RESULT CHAR220 CHAR 220 0 Text: Length 220
Regards,
Srini
2007 Mar 10 6:13 AM
here is the XSLT program YSIMPLEXMLTOITAB1
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<OUTTAB>
<xsl:for-each select="//String">
<ZTEST11>
<FINAL_RESULT>
<xsl:value-of select="."></xsl:value-of>
</FINAL_RESULT>
</ZTEST11>
</xsl:for-each>
</OUTTAB>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>ABAP report program to test this.
REPORT yjfkdjkfmxl
NO STANDARD PAGE HEADING.
DATA: BEGIN OF ztest11 OCCURS 0,
final_result(220),
END OF ztest11 .
DATA: xml_string TYPE string .
DATA: xslt_error TYPE REF TO cx_xslt_exception,
xslt_message TYPE string .
CLEAR xml_string .
CONCATENATE
`<?xml version="1.0" encoding="utf-8"?>`
`<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> `
`<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">`
`<ns:matchResponse xmlns:ns='http://www.openuri.org/'>`
`<matchResult xsi:type='SOAP-ENC:Array' SOAP-ENC:arrayType='xsd:string[18]'>`
`<String xsi:type='xsd:string'>23901|EUS|20060625 |ABU NIDAL ORGANISATION||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23934|EUS|20060625 |ABU NIDAL ORGANISATSIOON||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23940|EUS|20060625 |ABU NIDALORGANIZACIJA||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>4228|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||DZ|ALGERIA|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4229|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||LB|LEBANON|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4231|sdme|19950301 605084 19950125|ABU NIDAL ORGANIZATION||||||LY|LIBYAN ARAN JAMAHIRIYA|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4232|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||SD|SUDAN|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>4233|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||IQ|IRAQ|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>6643|dto|19971008 6252649 199710086651088 200110056856860 20031002|ABU NIDAL ORGANIZATION||||||XX|ALL|68|56860 |20031002|19971008|20880808</String>`
`<String xsi:type='xsd:string'>23941|EUS|20060625 |ABU NIDAL SZERVEZET||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>4332|sdme|19950126 605084 19950125|NIDAL, ABU|DOB: May 1937 or 1940||JAFFA|||IL|ISRAEL|60|5084 |19950125|19950123|20880808</String>`
`<String xsi:type='xsd:string'>23950|EUS|20060625 |ORGANIZACIJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23911|EUS|20060625 |ORGANIZACIÓN ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23946|EUS|20060625 |ORGANIZACJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23916|EUS|20060625 |ORGANIZAÇÃO ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23955|EUS|20060625 |ORGANIZZAZIONE ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:type='xsd:string'>23949|EUS|20060625 |ORGANIZÁCIA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
`<String xsi:nil='true'></String>`
`</matchResult>`
`</ns:matchResponse>`
`</SOAP-ENV:Body>`
`</SOAP-ENV:Envelope>`
INTO xml_string .
TRY .
CALL TRANSFORMATION (`YSIMPLEXMLTOITAB1`)
SOURCE XML xml_string
RESULT outtab = ztest11[].
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
ENDTRY.
Regards
Raja
2007 Mar 11 6:33 PM
Hi Raja,
I could finally solve the issue. I added the 'String' at the end of for each select and '.' in the value of select. Thanks for your help.
Regards,
Srini
2008 Mar 17 8:14 PM
Hi Raja,
Once again i am facing the same issue. Output is not generating. Here is the Code and XML file.Could you please check and confirm what is the wrong in my code.
XML file:
-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<m:matchResponse xmlns:m="http://www.openuri.org/">
<matchResult soapenc:arrayType="xs:string[1]">
<enc:String xmlns:enc="http://www.openuri.org/encodedTypes">23417|finc|20060427 |BELMETALNERGO||||||X
X|ALL||||20060427|20880808
</enc:String>
</matchResult>
</m:matchResponse>
</soapenv:Body>
</soapenv:Envelope>
Code:
-
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hp="http://www.openuri.org/" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<OUTTAB>
<xsl:for-each select="soap:Envelope/soap:Body/hp:matchResponse/matchResult/enc:String">
<ZA2_RPL_DETAILS_S>
<FINAL_RESULTS>
<xsl:value-of select="."/>
</FINAL_RESULTS>
</ZA2_RPL_DETAILS_S>
</xsl:for-each>
</OUTTAB>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
Output:
-
Outtab is blank.
Could you please check and confirm.
Regards,
Srini