XML to ABAP Conversion Error - CX_SY_CONVERSION_DATA_LOSS
REPORT y_rpt_test .
TYPE-POOLS sscr.
DATA: restrict TYPE sscr_restrict,
opt_list TYPE sscr_opt_list,
*** TYPE sscr_***.
DATA: options TYPE STANDARD TABLE OF rfc_db_opt ,
fields TYPE STANDARD TABLE OF rfc_db_fld ,
meta TYPE STANDARD TABLE OF ywas_metadata ,
xml_out TYPE string .
data: xml_out_x type xstring.
DATA: wa_options LIKE LINE OF options,
wa_fields LIKE LINE OF fields ,
wa_meta LIKE LINE OF meta .
FIELD-SYMBOLS: <outtab> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
DATA: xslt_error TYPE REF TO cx_xslt_exception ,
xslt_message TYPE string .
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
TYPES: BEGIN OF s_text,
partnum(18) TYPE c,
LONG_DESC(3000) TYPE c,
END OF s_text.
data: lt_outtab type standard table of s_text,
is_outtab type s_text.
data: it_temp_text(1000) TYPE c OCCURS 0 with header line.
data : l_file TYPE string value 'C:xmlload.xml'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
FILETYPE = 'ASC'
tables
data_tab = it_temp_text.
loop at it_temp_text.
concatenate xml_out it_temp_text into xml_out.
endloop.
IF NOT xml_out IS INITIAL .
TRY .
CALL TRANSFORMATION (`ZTEST1`)
SOURCE XML xml_out
RESULT outtab = lt_outtab.
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
WRITE:/ xslt_message .
ENDTRY.
ENDIF .
break-point.
write : / 'test'.
==========================================================
I am using above code to convert input XML file into internal table I am getting conversion error. My input XML file looks is as follows. It is throwing this error in call transformation. Appreciate your help in Advance.
<MODIFIED BY MODERATOR - RESPECT THE 2,500 CHAR LIMIT>
Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 3:31 PM
Thanks for quick response.
I think the problem is with special characters in the input XML file. If I don't have special characters in XML file then it works fine.
Anyway here is the XSLT code. This is a generic XSLT code which I used from one of the examples
posted on this site.
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xa="urn:schemas-microsoft-com:xml-analysis:mddataset" xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<xsl:output method="xml" />
<xsl:variable name="fieldNames" select="//asx:abap/asx:values/FIELDCAT" />
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<!--FIELDCAT>
<xsl:apply-templates select="//YWAS_METADATA" />
</FIELDCAT-->
<OUTTAB>
<xsl:apply-templates select="//item" />
</OUTTAB>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="//YWAS_METADATA">
<item>
<xsl:for-each select="*">
<!--column ><xsl:apply-templates/></column-->
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:for-each>
</item>
</xsl:template>
<xsl:template match="//item">
<item>
<xsl:for-each select="*">
<!--column ><xsl:apply-templates/></column-->
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:for-each>
</item>
</xsl:template>
</xsl:stylesheet>
Similar Messages
-
XML = ABAP conversion error (CX_ST_GROUP_MISSING_CASE)
Hi ,
we are using wsdl connection
We are not able to display data in SAP
its showing error :
Error during <b>XML => ABAP conversion</b> (Response Message; error ID: CX_ST_GROUP_MISSING_CASE; (/1SAI/TXS00000000000000000010 XML Bytepos.: 205 XML Path: root(1)ns0:requestEventResponse(1) Error Text: Element 'TESTRESPONSE' missing))Are you by any chance using a message interface with multiple namespaces as source for your ABAP proxy? I am currently facing the very same problem and my best guess so far is that the ABAP proxy cannot handle multiple namespaces in one message.
Did you get open a ticket on SapOSS? Any hints are very welcome!
Stefan -
Hi Experts,
I am using SFP transaction.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = lt_file_table
rc = lv_rc
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
READ TABLE lt_file_table
INTO lv_filename
INDEX 1.
cl_gui_frontend_services=>gui_upload(
EXPORTING
filename = lv_filename
filetype = 'BIN' "Binary
IMPORTING
filelength = lv_filelength
CHANGING
data_tab = lt_rawtab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19 ).
Get FP reference
DATA: lo_fp TYPE REF TO if_fp VALUE IS INITIAL.
lo_fp = cl_fp=>get_reference( ).
For handling exceptions
DATA: lo_fpex TYPE REF TO cx_fp_runtime VALUE IS INITIAL.
TRY.
Create PDF Object using destination 'ADS' (<-- this is how it is
defined in SM59)
DATA: lo_pdfobj TYPE REF TO if_fp_pdf_object VALUE IS INITIAL.
lo_pdfobj = lo_fp->create_pdf_object( connection = 'ADS' ).
FIELD-SYMBOLS: <ls_rawtab> LIKE LINE OF lt_rawtab.
Move to XSTRING
LOOP AT lt_rawtab ASSIGNING <ls_rawtab>.
CONCATENATE pdf_data <ls_rawtab>-data INTO pdf_data IN BYTE MODE.
ENDLOOP.
Set document
lo_pdfobj->set_document(
EXPORTING
pdfdata = PDF_DATA).
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
IM_XSTRING = XML_DATA
IMPORTING
EX_STRING = LV_XML_DATA_STRING.
Remove NEW-LINE character from XML data in STRING format
CLASS cl_abap_char_utilities DEFINITION LOAD.
REPLACE ALL OCCURrENCES OF cl_abap_char_utilities=>newline IN
lv_xml_data_string WITH ''.
Make the XML envelope compliant with identity transform
REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'
IN lv_xml_data_string
WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns :asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.
REPLACE '</data>' IN lv_xml_data_string WITH '</asx:values></asx:abap>'.
Apply the identity transform and convert XML into ABAP in one step
CALL TRANSFORMATION ('ID')
SOURCE XML lv_xml_data_string
RESULT out = out.
But getting error
Short text
XSLT: No valid XML source
Runtime Errors XSLT_BAD_SOURCE_CONTEXT
Except. CX_XSLT_RUNTIME_ERROR
How i call -->call transforamtion...Can any one please tell me how to convert XML to abap internal table?...
ThanksHi,
I just catch the exception.
Regards,
Mathi -
Simple transformation XML to ABAP, runtime error: CX_ST_REF_ACCESS
Hi, all experts,
I got a runtime error CX_ST_REF_ACCESS, while I tried to use Simple Transformation to transfer XML-String to ABAP internal table.
Can anybody help me to fix the problem? Thanks very much. It's urgent.
The code of transformation like this:
<tt:root name="DATA"/>
<tt:template>
<node>
<tt:deserialize>
<tt:loop ref=".DATA" name="mdr_data">
<tt:attribute name="type">
<tt:value ref="$mdr_data.lf_type"/>
</tt:attribute>
<tt:attribute name="objid">
<tt:value ref="$mdr_data.lf_objid"/>
</tt:attribute>
<tt:attribute name="name" value-ref="$mdr_data.lf_name"/>
<tt:attribute name="short" value-ref="$mdr_data.lf_short"/>
</tt:loop>
</tt:deserialize>
</node>
</tt:template>
The Data-structure in my Report:
DATA: BEGIN OF ls_mdr_data,
lf_type TYPE /ehr/ct_dt_bo_type,
lf_objid TYPE realo,
lf_name TYPE stext,
lf_short TYPE short_d,
END OF ls_mdr_data,
lt_result_data like TABLE OF ls_mdr_data.
If I call the transformation use the XML-String like:
<node type="MDRFOLDER" objid="50016122" name="MDR Root Folder" short="MDR Root"/>
I got the error CX_ST_REF_ACCESS:
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_ST_REF_ACCESS', was not caught and
therefore caused a runtime error.
The reason for the exception is:
The goal was to access variable "LF_TYPE". However, this access was not
possible.Hi, all experts,
I got a runtime error CX_ST_REF_ACCESS, while I tried to use Simple Transformation to transfer XML-String to ABAP internal table.
Can anybody help me to fix the problem? Thanks very much. It's urgent.
The code of transformation like this:
<tt:root name="DATA"/>
<tt:template>
<node>
<tt:deserialize>
<tt:loop ref=".DATA" name="mdr_data">
<tt:attribute name="type">
<tt:value ref="$mdr_data.lf_type"/>
</tt:attribute>
<tt:attribute name="objid">
<tt:value ref="$mdr_data.lf_objid"/>
</tt:attribute>
<tt:attribute name="name" value-ref="$mdr_data.lf_name"/>
<tt:attribute name="short" value-ref="$mdr_data.lf_short"/>
</tt:loop>
</tt:deserialize>
</node>
</tt:template>
The Data-structure in my Report:
DATA: BEGIN OF ls_mdr_data,
lf_type TYPE /ehr/ct_dt_bo_type,
lf_objid TYPE realo,
lf_name TYPE stext,
lf_short TYPE short_d,
END OF ls_mdr_data,
lt_result_data like TABLE OF ls_mdr_data.
If I call the transformation use the XML-String like:
<node type="MDRFOLDER" objid="50016122" name="MDR Root Folder" short="MDR Root"/>
I got the error CX_ST_REF_ACCESS:
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_ST_REF_ACCESS', was not caught and
therefore caused a runtime error.
The reason for the exception is:
The goal was to access variable "LF_TYPE". However, this access was not
possible. -
Xml to oracle conversion error
hai guys
i am having a procedure as follows to convert xml file into oracle.
Create or replace procedure xml(xml_doc varchar2,table_name varchar2)
as
v_buf varchar2(30000);
v_insctx dbms_xmlsave.ctxtype;
v_rows number;
v_file varchar2(30000);
begin
xmldom.writetofile(xmlparser.parse(xml_doc), v_file);
v_insctx := dbms_xmlsave.newcontext(table_name); -- get the context handle
v_rows := dbms_xmlsave.insertxml(v_insctx,v_file); -- this inserts the document
dbms_output.put_line(to_char(v_rows) || ' rows inserted');
dbms_xmlsave.closecontext(v_insctx);
end;
Execution
Exec xml( '/home/main/SAMPLE.xml','SAMPLE');
I am Getting the error
Error
ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException: name can't be null
ORA-06512: at "SYS.XMLDOCUMENTCOVER", line 0
ORA-06512: at "SYS.XMLDOM", line 1829
ORA-06512: at "SCOTT.XML", line 8
ORA-06512: at line 7
if Any one find solution please reply
thanksxmldom.writetofile(xmlparser.parse(xml_doc), v_file);You haven't assigned anything to v_file. That would seem to be a good fit with an error message complaining about names being null.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Hi Experts ,
i have a scenario proxy to soap where i am getting error while getting the response .
we are sending the request successfully and getting response .some times we are getting in proxy level error below
PARSE_APPLICATION_DATA Error during XML => ABAP conversion: Response Message; CX_ST_DESERIALIZATION_ERROR in /1SAI/SAS0446CC11CC6EC1AD4789 Line 24 An error occurred when deserializing in the simple transformation program /1SAI/SAS0446CC11CC6EC1AD4789 (Cha
Please help us to fix this bug in proxy response.
Regards
RaviHello Ravinder,
Can you please post the complete stack trace, it seems to be some fields are getting truncated i,e data sent from the program to the proxy object might be violating some length restrictions.
Please check your message interface field lengths and what is being passed to the proxy.
Regards,
Ravi. -
Error during XML = ABAP conversion
Hi
We have a synchronous call from a SRM application through a proxy framework to a vendor http server through XI. The response from the vendor's http server is returned through a custom structure -and is returned through XI back to the calling SRM application.
After receiving the response, the calling SRM application checks for a particular field value of the custom return structure for a error code and sends out an email - accordingly.
Now, the response message comes back from the vendor's server - but the lines of code beyond the synchronous call in the SRM calling application does not get executed ( mail generation part ) I get the following error on the SRM front end - <b>Error in Exchange Infrastructure: Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT; (/1SAI/TXS00000000000000000001 XML Bytepos.: 39 XML Path: Error Text: System e</b>
Now, this error when occured in our dev environment, I set the extended xml attribute property to 'X' for the synchronous payload in calling SRM application code. The problem is, this error is occuring now in our QA environment inspite of this property being set.
Any ideas/suggestions as to why this message occurs in a standard proxy framework setup ?Hi,
Please check this link <a href="http://help.sap.com/saphelp_nw04/helpdata/en/0c/402040abf2c442e10000000a1550b0/content.htm"></a>
This talks about having the first element of the xml fragment as X0.
Hope this helps.
Regards,
Smitha. -
Error during XML = ABAP conversion, empty tag
Hi.
Im sending data from a Data Base to a proxy using BI.
But when I get an empty response from the data base wich gives me an empty XML tag the proxy shows me an error:
-PARSE_APPLICATION_DATA Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT;
-Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT;
-System expected the end of the element 'STMT_DC_response'
This is the message that originates the fail:
<?xml version="1.0" encoding="utf-8" ?>
<ns0:MT_PRV23_BS_desg_response xmlns:ns0="urn:tompla-com:xi:ventas_SD">
<STMT_response>
<row>
<TIPO>P</TIPO>
<NUM_OT>55062330</NUM_OT>
<NUM_DESGLOSE>1</NUM_DESG>
<CANT_DESG>1724000</CANT_DESG>
</row>
</STMT_response>
<STMT_DC_response />
</ns0:MT_PRV23_BD_desg_response>
In case that the tag is filled runs ok
<?xml version="1.0" encoding="utf-8" ?>
<ns0:MT_PRV23_BD_desg_response xmlns:ns0="urn:tompla-com:xi:ventas_SD">
<STMT_response>
<row>
<TIPO>P</TIPO>
<NUM_OT>55062330</NUMERO_OT>
<NUM_DESG>1</NUM_DESG>
<CANT_DESG>1724000</CANT_DESG>
</row>
</STMT_response>
<STMT_DC_response>
<row>
<TIPO>P</TIPO>
<NUMERO_OT>55062330</NUMERO_OT>
<NUMERO_DESGLOSE />
<COD_CAR_ADICIONA>8</COD_CAR_ADICIONA>
<PORC_CAR_ADICION>1</PORC_CAR_ADICION>
</row>
</STMT_DC_response>
</ns0:MT_PRV23_BD_desg_response>
The definition for the data is:
STMT_DC_response 0..1
row 0..n
tipo 0..1
Thanks for the help you can give me about my problem with empty tags.I moved this question to other forum
Expert Forums » SAP NetWeaver » Exchange Infrastructure -
Simple Transformation XML to ABAP - error CX_ST_MATCH_ELEMENT
Hi all,
I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
<?xml version="1.0" encoding="iso-8859-1" ?>
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
<NETWORK>E60000000000</NETWORK>
<OPERAZIONE>0010</OPERAZIONE>
- <TABELLA>
- <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
<MANDT>300</MANDT>
<NETWORK>E60000000000</NETWORK>
<OPERAZIONE>0010</OPERAZIONE>
<ID_ACT>1</ID_ACT>
<DESC_ACT>ATTIVITÀ1</DESC_ACT>
<LONG_TXT></LONG_TXT>
<MAKE_BUY></MAKE_BUY>
<WP></WP>
<EVENTO_TECH></EVENTO_TECH>
<TIPO_LEGAME></TIPO_LEGAME>
<CONSEGNA></CONSEGNA>
</ROW>
- <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
<MANDT>300</MANDT>
<NETWORK>E60000000000</NETWORK>
<OPERAZIONE>0010</OPERAZIONE>
<ID_ACT>2</ID_ACT>
<DESC_ACT>ATTIVITÀ2</DESC_ACT>
<LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT>
<MAKE_BUY>M</MAKE_BUY>
<WP></WP>
<EVENTO_TECH></EVENTO_TECH>
<TIPO_LEGAME></TIPO_LEGAME>
<CONSEGNA></CONSEGNA>
</ROW>
</TABELLA>
</asx:values>
</asx:abap>
my transformation is
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"></tt:root>
<tt:root name="NETWORK"></tt:root>
<tt:root name="OPERAZIONE"></tt:root>
<tt:template>
<abap>
<values>
<network>
<tt:value ref="NETWORK"></tt:value>
</network>
<operazione>
<tt:value ref="OPERAZIONE"></tt:value>
</operazione>
<tabella>
<tt:loop ref=".ROOT" name="line">
<mandt>
<tt:value ref="$line.mandt"></tt:value>
</mandt>
<network>
<tt:value ref="$line.network"></tt:value>
</network>
<OPERAZIONE>
<tt:value ref="$line.OPERAZIONE"></tt:value>
</OPERAZIONE>
<ID_ACT>
<tt:value ref="$line.ID_ACT"></tt:value>
</ID_ACT>
<DESC_ACT>
<tt:value ref="$line.DESC_ACT"></tt:value>
</DESC_ACT>
<LONG_TXT>
<tt:value ref="$line.LONG_TXT"></tt:value>
</LONG_TXT>
<MAKE_BUY>
<tt:value ref="$line.MAKE_BUY"></tt:value>
</MAKE_BUY>
<WP>
<tt:value ref="$line.WP"></tt:value>
</WP>
<EVENTO_TECH>
<tt:value ref="$line.EVENTO_TECH"></tt:value>
</EVENTO_TECH>
<TIPO_LEGAME>
<tt:value ref="$line.TIPO_LEGAME"></tt:value>
</TIPO_LEGAME>
<CONSEGNA>
<tt:value ref="$line.CONSEGNA"></tt:value>
</CONSEGNA>
</tt:loop>
</tabella>
</values>
</abap>
</tt:template>
</tt:transform>
when I execute my code
the system dump with this error
ST_MATCH_FAIL
excep. CX_ST_MATCH_ELEMENT
TRY.
CALL TRANSFORMATION ('ZT_NETWORK')
SOURCE XML lv_xml_data_string
RESULT network = l_network
operazione = l_operazione
root = it_data_tmp.
CATCH cx_sy_conversion_data_loss .
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
WRITE:/ xslt_message .
ENDTRY.
Any help?
thanks
enzoEnzo Porcasi wrote:
> I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
>
<?xml version="1.0" encoding="iso-8859-1" ?>
> <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
> <asx:values>
Your XML is strange, it looks like a mix of pdf form content (xfa) and identity transformation (asx).
Could you explain more ?
Anyway, I tried to find out the errors (not only cx_st_match_element, that was just a catch missing), it works with the following program. Here are the main issues I have found :
- always catch exception class cx_st_error when you use simple transformations (it contains cx_st_match_element and all other simple transformation exceptions)
- xml "asx:abap" and "asx:values" in your input XML are useless, they are only used by identity transformation ("ID"); you may keep them if you want, but I advise you to see why they are in the xml !
- Use same case in your tags (if xml contains in the transformation so that it corresponds to the input XML
- I renamed all abap names with prefix ABAP_ so that to clearly differentiate xml tags and abap field names (so that it is more easy to understand, for every sdn reader; I hope it will help as I didn't find many threads in the forum).
Simple transformation :
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ABAP_NETWORK"></tt:root>
<tt:root name="ABAP_OPERAZIONE"></tt:root>
<tt:root name="ABAP_TABELLA"></tt:root>
<tt:template>
<ROOT>
<NETWORK>
<tt:value ref=".ABAP_NETWORK"></tt:value>
</NETWORK>
<OPERAZIONE>
<tt:value ref=".ABAP_OPERAZIONE"></tt:value>
</OPERAZIONE>
<TABELLA>
<tt:loop ref=".ABAP_TABELLA" name="line">
<ROW>
<MANDT>
<tt:value ref="$line.ABAP_MANDT"></tt:value>
</MANDT>
<NETWORK>
<tt:value ref="$line.ABAP_NETWORK"></tt:value>
</NETWORK>
<OPERAZIONE>
<tt:value ref="$line.ABAP_OPERAZIONE"></tt:value>
</OPERAZIONE>
<ID_ACT>
<tt:value ref="$line.ABAP_ID_ACT"></tt:value>
</ID_ACT>
<DESC_ACT>
<tt:value ref="$line.ABAP_DESC_ACT"></tt:value>
</DESC_ACT>
<LONG_TXT>
<tt:value ref="$line.ABAP_LONG_TXT"></tt:value>
</LONG_TXT>
<MAKE_BUY>
<tt:value ref="$line.ABAP_MAKE_BUY"></tt:value>
</MAKE_BUY>
<WP>
<tt:value ref="$line.ABAP_WP"></tt:value>
</WP>
<EVENTO_TECH>
<tt:value ref="$line.ABAP_EVENTO_TECH"></tt:value>
</EVENTO_TECH>
<TIPO_LEGAME>
<tt:value ref="$line.ABAP_TIPO_LEGAME"></tt:value>
</TIPO_LEGAME>
<CONSEGNA>
<tt:value ref="$line.ABAP_CONSEGNA"></tt:value>
</CONSEGNA>
</ROW>
</tt:loop>
</TABELLA>
</ROOT>
</tt:template>
</tt:transform>
Program and XML included :
REPORT zsro2.
DATA l_network TYPE string.
DATA l_operazione TYPE string.
DATA : BEGIN OF lt_data_tmp OCCURS 0,
abap_mandt TYPE string,
abap_network TYPE string,
abap_operazione TYPE string,
abap_id_act TYPE string,
abap_desc_act TYPE string,
abap_long_txt TYPE string,
abap_make_buy TYPE string,
abap_wp TYPE string,
abap_evento_tech TYPE string,
abap_tipo_legame TYPE string,
abap_consegna TYPE string,
END OF lt_data_tmp.
DATA xslt_error TYPE REF TO cx_xslt_exception.
DATA lo_st_error TYPE REF TO cx_st_error.
DATA lv_xml_data_string TYPE string.
DATA xslt_message TYPE string.
DEFINE conc.
concatenate lv_xml_data_string &1 into lv_xml_data_string.
END-OF-DEFINITION.
*conc '<?xml version="1.0" encoding="iso-8859-1" ?>'.
*conc '<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">'.
*conc ' <asx:values>'.
conc ' <ROOT>'.
conc ' <NETWORK>E60000000000</NETWORK> '.
conc ' <OPERAZIONE>0010</OPERAZIONE> '.
conc ' <TABELLA>'.
conc ' <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
conc ' <MANDT>300</MANDT> '.
conc ' <NETWORK>E60000000000</NETWORK> '.
conc ' <OPERAZIONE>0010</OPERAZIONE> '.
conc ' <ID_ACT>1</ID_ACT> '.
conc ' <DESC_ACT>ATTIVITÀ1</DESC_ACT> '.
conc ' <LONG_TXT></LONG_TXT> '.
conc ' <MAKE_BUY></MAKE_BUY> '.
conc ' <WP></WP> '.
conc ' <EVENTO_TECH></EVENTO_TECH> '.
conc ' <TIPO_LEGAME></TIPO_LEGAME> '.
conc ' <CONSEGNA></CONSEGNA> '.
conc ' </ROW>'.
conc ' <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
conc ' <MANDT>300</MANDT> '.
conc ' <NETWORK>E60000000000</NETWORK> '.
conc ' <OPERAZIONE>0010</OPERAZIONE> '.
conc ' <ID_ACT>2</ID_ACT> '.
conc ' <DESC_ACT>ATTIVITÀ2</DESC_ACT> '.
conc ' <LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT> '.
conc ' <MAKE_BUY>M</MAKE_BUY> '.
conc ' <WP></WP> '.
conc ' <EVENTO_TECH></EVENTO_TECH> '.
conc ' <TIPO_LEGAME></TIPO_LEGAME> '.
conc ' <CONSEGNA></CONSEGNA> '.
conc ' </ROW>'.
conc ' </TABELLA>'.
conc ' </ROOT>'.
*conc ' </asx:values>'.
*conc '</asx:abap>'.
DATA lv_xml_data_string_2 TYPE string.
TRY.
CALL TRANSFORMATION zsro
SOURCE
XML lv_xml_data_string
RESULT
abap_network = l_network
abap_operazione = l_operazione
abap_tabella = lt_data_tmp[].
CATCH cx_sy_conversion_data_loss .
CATCH cx_st_error INTO lo_st_error.
xslt_message = lo_st_error->get_text( ).
WRITE:/ xslt_message .
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
WRITE:/ xslt_message .
ENDTRY.
BREAK-POINT. -
Hello,
From a provider we get the following XSD from a response message:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://xxx" targetNamespace="http://yyy">
<xsd:element name="loginResponse" type="loginResponse" />
<xsd:complexType name="loginResponse">
<xsd:sequence>
<xsd:element name="result" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
His actual response looks like this:
<SOAP-ENV:loginResponse
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAPENC='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-Instance'>
<Result xsi:type='xsd:string'>artv8uv38gvqu05gjohv26g8l5</Result>
</SOAP-ENV:loginResponse>
PI accepts this well, but during the conversion from XML to ABAP we get the following error:
PARSE_APPLICATION_DATA Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT; (/1SAI/TXS3656E9BD8
Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT; (/1SAI/TXS3656E9BD8A34AE8B7F16 XML Bytepos
Element 'loginResponse' verwacht
I have the impression that there is a problem with the namespace and wonder how I can solve this. I do not know enough about XML to judge if the returned XML is valid according to the definition. Maybe the problem lies there.
Thanks for any help.
KrisYou are right. The error is the root node:
SOAP-ENV:loginResponse
This prefix is not allowed.
It should be something like this:
<loginResponse xmlns="http://xxx"
Edited by: Stefan Grube on Aug 23, 2010 4:35 PM -
XML - ABAP conversion, empty tag
Hi.
Im sending data from a DB to a proxy using XI.
But when I get an empty response from the DB, wich gives me an empty XML tag the proxy shows me an error:
-PARSE_APPLICATION_DATA Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT;
-Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT;
-System expected the end of the element 'STMT_DC_response'
This is the message that originates the fail:
<ns0:MT_xxx_response xmlns:ns0="urn:s-com:xi:SD">
<STMT_response>
<row>
<c11>P</c11>
<c12>55062330</c12>
<c13>1</c13>
</row>
</STMT_response>
<STMT_DC_response />
</ns0:MT_xxx_response>
In case that the tag is filled runs ok
<ns0:MT_xxx_response xmlns:ns0="urn:s.com:xi:SD">
<STMT_response>
<row>
<c11>P</c11>
<c12>55062330</c12>
<c13>1</c13>
</row>
</STMT_response>
<STMT_DC_response>
<row>
<c21>P</c21>
<c22>55062330</c22>
<c23 />
</row>
</STMT_DC_response>
</ns0:MT_xxx_response>
The definition for the data is:
STMT_DC_response 0..1
row 0..n
tipo 0..1
Thanks for the help you can give me about my problem with empty tags.thanks for your help!
yes, The definition for the data is:
STMT_DC_response 0..1
to be sure I disabled that node, so I wont get it from the DB, and It was ok
this is ok:
<ns0:MT_xxx_response xmlns:ns0="urn:s-com:xi:SD">
<STMT_response>
<row>
<c11>P</c11>
<c12>55062330</c12>
<c13>1</c13>
</row>
</STMT_response>
</ns0:MT_xxx_response>
but this is not
<ns0:MT_xxx_response xmlns:ns0="urn:s-com:xi:SD">
<STMT_response>
<row>
<c11>P</c11>
<c12>55062330</c12>
<c13>1</c13>
</row>
</STMT_response>
<STMT_DC_response />
</ns0:MT_xxx_response> -
"character conversion error" while parsing xml files
Hello,
I'm trying to parse MusicXML (Recordare) files, but I'm getting an exception.
I'm using the SAX parser (javax.xml.parsers.SAXParser).
Here is the code I use to instantiate it:
final javax.xml.parsers.SAXParserFactory saxParserFactory = javax.xml.parsers.SAXParserFactory.newInstance();
final javax.xml.parsers.SAXParser saxParser = saxParserFactory.newSAXParser();
final org.xml.sax.XMLReader parser = saxParser.getXMLReader();
I'm using my own handler, but I get the same exception even if I use org.xml.sax.helpers.DefaultHandler.
The error I get is:
Character conversion error: "Illegal ASCII character, 0xc2" (line number may be too low).
The first few lines of my xml files look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE score-partwise
PUBLIC "-//Recordare//DTD MusicXML 0.6 Partwise//EN"
"http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise>
[...etc...]
If I delete the <!DOCTYPE ...> line, then I don't get the exception anymore. But the MusicXML files I get (from some other program) always contain this line, and it would be quite some work to delete them from every file manually.
So does anyone know if there is a way to avoid deleting that line in every file, while still being able to parse the xml files without exceptions?
Or maybe does anyone know what the exact cause of the exception is? (because I don't know what exactly causes it)
Thank you in advance.
Greetz,
JipoSo does anyone know if there is a way to avoid
deleting that line in every file, while still being
able to parse the xml files without exceptions?ok this is side-stepping the real problem but I've used this code to filterout DTD references for other reasons public static InputStream filterOutDTDRef(InputStream in) throws IOException {
BufferedReader iniReader = new BufferedReader(new InputStreamReader(in));
StringBuffer newXML = new StringBuffer();
for(String line = iniReader.readLine(); line!=null; line = iniReader.readLine())
newXML.append(line+"\n");
in.close();
int s = newXML.indexOf("<!DOCTYPE ");
if(s!=-1)
newXML.replace(s,newXML.indexOf(">",s)+1,"");
return new ByteArrayInputStream(newXML.toString().getBytes());
}and it actually speeds up the parsing phase too (since the DTD ref.s were on the web and the XML standard mandates that there is a fetch for each xml file parsed..)
you can feed the above into the InputSource constructor that takes an InputStream argument.
Now for the real problem... 0xc2 is "LATIN CAPITAL LETTER A WITH CIRCUMFLEX" according to a unicode chart - which is not an ASCII character (as the error message correctly reports). I'm not sure why the file is being parsed as ASCII though? You could try parsing in a FileReader to the inputsource and hope it picks up the default character encoding of your system, and that that character encoding matches the file. Or you could try passing in a FileReader constructed with a explicit character encoding (eg "UTF8") and see if that does the trick?
asjf -
ResultSet XML Conversion Error
Hi,
BPEL, SOA 11g, DB2 Stored procedure,
In a BPEL service I am getting this error while invoking a DB2 Stored procedure with Strong XSD. I am using assign to copy the input parameter to the input parameters of Stored procedure.
not able to figure out why this error message is coming.
java.lang.Exception: oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'JDE_DBA' failed due to: ResultSet XML Conversion Error. An error occurred while converting from a ResultSet to XML. Unable to convert a ResultSet to XML. Cause: java.lang.NullPointerException ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. at oracle.sysman.emas.model.wsmgt.WSTestModel.invokeOperation(WSTestModel.java:575) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:381) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:298) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.el.parser.AstValue.invoke(AstValue.java:157) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283) a
---------------- BPEL Code --------
<?xml version = "1.0" encoding = "UTF-8" ?>
<!--
Oracle JDeveloper BPEL Designer
Created: Fri Dec 10 10:24:23 PST 2010
Author: chaitanyad
Purpose: Synchronous BPEL Process
-->
<process name="UPCMatchOrder"
targetNamespace="http://xmlns.oracle.com/CD_JDE_Application_jws/JDE_UPCMatchOrder/UPCMatchOrder"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:client="http://xmlns.oracle.com/CD_JDE_Application_jws/JDE_UPCMatchOrder/UPCMatchOrder"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/CD_JDE_Application/JDE_UPCMatchOrder/JDE_DBA"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/QAMODA73/X56714P/">
<!--
PARTNERLINKS
List of services participating in this BPEL process
-->
<partnerLinks>
<!--
The 'client' role represents the requester of this service. It is
used for callback. The location and correlation information associated
with the client role are automatically set using WS-Addressing.
-->
<partnerLink name="upcmatchorder_client" partnerLinkType="client:UPCMatchOrder" myRole="UPCMatchOrderProvider"/>
<partnerLink name="JDE_DBA" partnerRole="JDE_DBA_role"
partnerLinkType="ns1:JDE_DBA_plt"/>
</partnerLinks>
<!--
VARIABLES
List of messages and XML documents used within this BPEL process
-->
<variables>
<!-- Reference to the message passed as input during initiation -->
<variable name="inputVariable" messageType="client:UPCMatchOrderRequestMessage"/>
<!-- Reference to the message that will be returned to the requester-->
<variable name="outputVariable" messageType="client:UPCMatchOrderResponseMessage"/>
<variable name="Invoke_1_InputVariable" messageType="ns1:args_in_msg"/>
<variable name="Invoke_1_OutputVariable" messageType="ns1:args_out_msg"/>
</variables>
<!--
ORCHESTRATION LOGIC
Set of activities coordinating the flow of messages across the
services integrated within this business process
-->
<sequence name="main">
<!-- Receive input from requestor. (Note: This maps to operation defined in UPCMatchOrder.wsdl) -->
<receive name="receiveInput" partnerLink="upcmatchorder_client" portType="client:UPCMatchOrder" operation="process" variable="inputVariable" createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<assign name="Assign_3">
<copy>
<from variable="inputVariable" part="InputMessage"/>
<to variable="Invoke_1_InputVariable" part="InputParameters"/>
</copy>
</assign>
<invoke name="Invoke_1" inputVariable="Invoke_1_InputVariable"
outputVariable="Invoke_1_OutputVariable" partnerLink="JDE_DBA"
portType="ns1:JDE_DBA_ptt" operation="JDE_DBA"/>
<assign name="Assign_2">
<copy>
<from variable="Invoke_1_OutputVariable" part="OutputParameters"/>
<to variable="outputVariable" part="OutputMessage"/>
</copy>
</assign>
<reply name="replyOutput" partnerLink="upcmatchorder_client" portType="client:UPCMatchOrder" operation="process" variable="outputVariable"/>
</sequence>
</process>
Regards,
-CDHi Sanjay,
The JDBC sender adapter returns the rows selected from the database in the follwoing format.
<resultset>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
</resultset>
This error occurs , when the source datatype you have created for the JDBC adapter does not match with this format. I would suggest that you check the source format along with the occurence of your field.
Regards,
Bhavesh -
Appication Server: 10g, Database: Oracle 9i and Oracle 10g
I have a table 'sw_icd2' in the database that has one column of XMLType.
The code below, attempts to query this table as 'select * from sw_icd2' and display the result. I was able to execute this query in sqlplus.
But when I run a program using XSU in JDeveloper:
OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from sw_icd2");
XMLDocument domDoc = (XMLDocument)qry.getXMLDOM();
domDoc.print(System.out);
StringWriter s = new StringWriter(10000);
domDoc.print(new PrintWriter(s));
System.out.println(s.toString());
qry.close();
I get the following Error:
"oracle.xml.sql.OracleXMLSQLException: Conversion to String failed"
Any ideas on how I can resolve this issue? Your help would be appreciated.
Thanks!Okay, it looks like the problem has something to do with the TIMESTAMP data type in tables.
oracle.xml.sql.query.OracleXMLQuery can't seem to handle tables with the TIMESTAMP data type.
this code ran fine on my machine :
import oracle.jdbc.driver.*;
import oracle.xml.sql.query.OracleXMLQuery;
import java.lang.*;
import java.sql.*;
public class testXMLSQL {
public static void main(String[] args) {
try {
// Create the connection
System.out.println("before getConnection ");
Connection conn = getConnection("scott","tiger");
System.out.println("after getConnection ");
// Create the query class
OracleXMLQuery qry = new OracleXMLQuery(conn, "SELECT * FROM EMP");
System.out.println("after OracleXMLQuery object created ");
// Get the XML string
String str = qry.getXMLString();
// Print the XML output
System.out.println("The XML output is:\n"+str);
// Always close the query to get rid of any resources..
qry.close();
} catch(SQLException e) {
System.out.println(e.toString());
// Get the connection given the user name and password.!
private static Connection getConnection(String username,
String password)
throws SQLException
// register the JDBC driver..
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
// Create the connection using the OCI8 driver
Connection conn =
DriverManager.getConnection(
"jdbc:oracle:thin:@<server_name>:1521:<sid>",
username,password);
return conn;
Then I created another table :
create table emp_test as select * from emp;
added a timestamp to it :
alter table emp_test add (time timestamp(6));
and filled it with timestamp information :
update emp_test set time = timestamp'2005-09-22 09:26:50.124';
ran the same code but changed the SQL to :
"SELECT * FROM EMP_TEST"
and got the error message :
The XML output is:
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: Conversion to String failed</ERROR>
looks like bug in OracleXMLQuery object?? -
XML to Forms conversion gives error for menus
We are trying the ORACLE <---> XML conversion Utility.
We want to convert a MMB to XML and store it in our repository. When we want to modify it we get the XML from the repository, convert it back to a MMB and edit it. This saves space in the repository DB.
Problem when we convert or MMB --> XML using like this frmf2xml.bat OVERWRITE=YES TRANS_MENU.mmb
the XML file is created.
Now when we try to convert the XML back to a MMB using this code frmxml2f OVERWRITE=YES PRINTTREE=YES USERID=userid/pwd@db TRANS_MENU_mmb.xml we get this error:
Oracle Forms 10.1.2 XML to Forms Tool
Copyright(c) 2001, 2005, Oracle. All rights reserved.
file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 164, Column 73>: XML-24523: (Error) Invalid value ' INTERNATIONAL_OUT_GOING_CALL_D_MENU ' for attribute: 'Name'
file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 773, Column 73>: XML-24523: (Error) Invalid value 'BILLING_PROCESS_MASTER_FILE_UP_MENU' for attribute: 'Name'
file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 823, Column 69>: XML-24523: (Error) Invalid value 'BANK_PAYMENT_AUDIT_REPORTS_MENU' for attribute: 'Name'
file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 864, Column 73>: XML-24523: (Error) Invalid value 'INFO_CONNECT_ACCOUNTING_INTERF_MENU' for attribute: 'Name'
file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 887, Column 73>: XML-24523: (Error) Invalid value 'DEALER_SOLD_SUBSCRIPTION_TRANS_MENU' for attribute: 'Name'
file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 917, Column 73>: XML-24523: (Error) Invalid value 'CHANNA_LEVEL_42444444444444444_MENU' for attribute: 'Name'
Invalid XML - file TRANS_MENU_mmb.xml does not validate against Forms XML Schema:
Invalid value 'INTERNATIONAL_OUT_GOING_CALL_D_MENU' for attribute: 'Name'
I found the problem. For submenus the XML adds a _MENU to the end of the name attribute and when the name of the menu is over 26 chars 26+5 = 31 becomes more than 30 characters. So when the XML is converted to the MMB we get an error because forms objects cannot have names of lengths > 30.
I think this could be a bug. We cannot modify the menu just for this since it is not practical.
Is this a known bug? Any workaround?
Edited by: Channa on Mar 5, 2010 2:11 AM
Edited by: Channa on Mar 5, 2010 2:12 AM
Edited by: Channa on Mar 5, 2010 2:13 AM
Edited by: Channa on Mar 5, 2010 2:13 AM
Edited by: Channa on Mar 18, 2010 9:22 PM
Edited by: Channa on Mar 18, 2010 9:25 PMHi Amol,
You XML structure contains deep levels. As far as i understand about the StrictXML2PlainBean module, this is not capable of handling deep structures.
This module is just an alternative to use FCC type functionality for other receiver adapters.
Please take a look at these links:
https://help.sap.com/saphelp_nwpi711/helpdata/EN/44/748d595dab6fb5e10000000a155369/content.htm
StrictXml2PlainBean - to have an XML - EDI conversion?
In case you want to achieve nested level content conversion, you may try this:
/people/karthiknarayan.kesavan2/blog/2007/08/22/file-content-conversion-for-multi-hierarchical-structure
I hope this helps.
Regards, Gaurav.
Maybe you are looking for
-
EREC: What is new in SAP E-Recruitment 6.0 SP5, SP7 and SP8?
Hi Does anyone know what are the features available or improved in SAP E-Recruitment 6.0 for Support Package 5,7 & 8? Regards Ridzuan Edited by: Ridzuan Mohsin on Nov 18, 2011 9:30 AM
-
Unique ID of Android Tablet...
Hi, I need to develope an application in which I need to get the Unique Id of the Android Tablet.As this is my first Android application I am not aware how to get this. This application has server connectivity using PHP. Please help me to get out of
-
ABAP /4 and ABAP OO difference on R/3 and ECC 6.0
Hi Gurus, Can any one tell me if ABAP/4 code behaves differently on R3 than ECC6. I know in BW all the routines written with ABAP/4 must be converted manually to ABAP OO(object oriented), is it the case for ERP too? A quick response will be greatly a
-
Down Payment AR Invoice freight Missing Functionality
Freight does not transfer to down payment invoice. Here is the scenario: Create a sales order (item or service type). Add freight charges. Create a down payment invoice - copy from sales order. All items transfer except no freight charges. This is a
-
HI I AM NEW TO ABAP..CAN ANYONE PROVIDE WITH A STEP BY STEP GUIDE TO ALV PROGRAMMING AND MODULE POOL PROGRAMMING