2013 May 17 7:23 AM
Hi,
I have a requirement to replace the obselete function module - TABLE_COMPRESS .
As per the thread given below http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP+Program+for+Compressing+and+De-Compressing+a+tabl...
I have used the method CALL METHOD cl_abap_gzip=>compress_text and CALL METHOD cl_abap_gzip=>decompress_text.
But i got the following runtime error.
The read XML document had an invalid format
The XML document did not have the specified format. Therefore, it could
not be interpreted correctly.
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_XSLT_FORMAT_ERROR', was not
caught and
therefore caused a runtime error.
The reason for the exception is:
The XML format was recognized as invalid for one of the following
reasons:
1. The basic structure of the document was incorrect - for example, the
root tag <abap> must be in the XML namespace "http://www.sap.com/abapxml".
2. Start tags appear where no more are expected - for example, when an integer value is to be read.
3. You have to specify the correct version number to read certain data types.
4. Too few or too many properties exist
Can any one help me .
2013 May 18 6:55 AM
Hi,
Yesterday there was no system access available for me, today debugged and the reason is the following. The below statement the parameter t_out is structure to which you are trying to do a table data capture.
CALL TRANSFORMATION id "Dump is coming here
SOURCE XML lw_xml_in
RESULT output = t_out.
Change the statement:
t_out like table of t_spfli,
to
t_out type table of spfli,
It will work and not give a Dump.
Cheers,
Arindam
2013 May 17 9:11 AM
Hi,
Looks like your input XML is erroneous. Check the the transactions SSTDEMO2 or SXSLTDEMO1. Should help you understand the CALL TRANSFORMATION.
I think something has gone wrong there. Can you post your code or sections of it and the exact location where the dump happens.
Cheers,
Arindam
2013 May 17 9:50 AM
Hi Arindam,
Please find the code below.
DATA: t_spfli TYPE TABLE OF spfli,
t_out like table of t_spfli,
lw_xml_in TYPE string,
lw_xml_out TYPE xstring.
SELECT carrid
connid
UP TO 2 ROWS
FROM spfli INTO TABLE t_spfli.
CALL TRANSFORMATION id
SOURCE output = t_spfli
RESULT XML lw_xml_in. " XML Format
IF sy-subrc NE 0.
RAISE compress_error.
ENDIF. " IF SY-SUBRC NE 0
CALL METHOD cl_abap_gzip=>compress_text
EXPORTING
text_in = lw_xml_in
* text_in_len = -1
* compress_level = 6
* conversion = 'DEFAULT'
IMPORTING
gzip_out = lw_xml_out " Compressed Output
* gzip_out_len =
.
.
IF sy-subrc NE 0.
RAISE compress_error.
ENDIF. " IF SY-SUBRC NE 0
*** Decompressing***
CALL METHOD cl_abap_gzip=>decompress_text
EXPORTING
gzip_in = lw_xml_out
* gzip_in_len = -1
* conversion = 'DEFAULT'
IMPORTING
text_out = lw_xml_in
* text_out_len =
.
>>>>>>>> CALL TRANSFORMATION id "Dump is coming here
SOURCE XML lw_xml_in
RESULT output = t_out.
IF sy-subrc NE 0.
RAISE compress_error.
ENDIF.
2013 May 17 10:56 AM
Hi,
It looks like the same code as given in the wiki. Have you checked your transformations in the repository. The error is that the document is not in XML format. Check if your transformation by name ID exists in transformation repository and if it does XML-> ABAP conversion.
Check the links below for a better understanding of the CALL TRANSFORMATION syntax and also how to call or create transformations.
http://help.sap.com/erp2005_ehp_03/helpdata/En/fd/9d734b389211d596a200a0c94260a5/content.htm
http://help.sap.com/abapdocu_70/en/ABAPCALL_TRANSFORMATION.htm
Cheers,
Arindam
2013 May 17 11:37 AM
Hi Arindam,
ABAP TO XML conversion is happening, as i could see the XML doc .
<?xml version="1.0" encoding="utf-8" ?>
</SPFLI>
</SPFLI>
</OUTPUT>
</asx:values>
</asx:abap>
But the reverse is not happening.
2013 May 17 12:10 PM
Hi,
That's what I am saying the transformation for changing from XML->ABAP is not present in the transformation by name 'ID'. Check the transformation 'ID'.
See the first link. The Transformation routine must have logic to change from XML->ABAP in transformation by name 'ID' . Else you will have to find a different Transformation routine
Check the thread below. Should help you to create a TRANSFORMATION to help you change from XML-> ABAP
http://scn.sap.com/thread/1289115
Cheers,
Arindam
2013 May 17 12:41 PM
Arindam Mondal wrote:
That's what I am saying the transformation for changing from XML->ABAP is not present in the transformation by name 'ID'. Check the transformation 'ID'.
ID is an XSLT transformation & not a Simple transformation. So ABAP2XML & XML2ABAP are implicit.
- Suhas
2013 May 17 1:26 PM
Hi,
You can try just TRANSFORMATION instead of TRANSFORMATION ID. They do the changing differently. Check the link
http://help.sap.com/abapdocu_731/en/abenasxml_id_vs_st_abexa.htm
Also check the transformation ID in transaction STRANS or via SE80 test the transformation ID. See the link below, it also says how you can debug the same. Test if the TRANSFORMATION 'ID' works
Cheers,
Arindam
2013 May 17 11:59 AM
Hello,
Did you check the "Comments" section of the WiKi. The person who has commented faced the same runtime error as yours, so there is definitely something wrong with the code.
Edited by: Suhas Saha
My mistake I just copy pasted the code in my system & it runs fine!
BR,
Suhas
2013 May 18 6:55 AM
Hi,
Yesterday there was no system access available for me, today debugged and the reason is the following. The below statement the parameter t_out is structure to which you are trying to do a table data capture.
CALL TRANSFORMATION id "Dump is coming here
SOURCE XML lw_xml_in
RESULT output = t_out.
Change the statement:
t_out like table of t_spfli,
to
t_out type table of spfli,
It will work and not give a Dump.
Cheers,
Arindam
2013 May 21 11:32 AM
2013 May 21 11:41 AM
Hope its solved. Check the link below you will get additional idea of how to create your own transformations.
http://scn.sap.com/docs/DOC-41774
Cheers,
Arindam