09-15-2008 12:21 PM
Hi, ABAPERs.
I'm implementing, following several threads, the uploading of a XML via an XML stream prior to set a XSLT transformation. The problem is that most of the 'job' is doing based on data defined as strings, but the file is cutted in a certain length. The question is that I wanna know is that limit really exists or whether I have to do an alternative uploading process to succeed.
Thanks for your helping.
09-15-2008 12:31 PM
No, string data is unlimited.
By SE11:
String data types (STRING, RAWSTRING) possess an unlimited length.
However, you can specify a length in the dictionary (at least 256 char.) . This length is taken as basis for optimizations when string fields are written to the database. From a certain length onwards, there are no further optimizations possible. Therefore, the length specification can be omitted (length 0).
If length 0 ist specified in the dictionary, no optimization is carried out during the storage on the database and an unlimited length is assumed.
Regards
Valter Oliveira.
09-15-2008 12:31 PM
No, string data is unlimited.
By SE11:
String data types (STRING, RAWSTRING) possess an unlimited length.
However, you can specify a length in the dictionary (at least 256 char.) . This length is taken as basis for optimizations when string fields are written to the database. From a certain length onwards, there are no further optimizations possible. Therefore, the length specification can be omitted (length 0).
If length 0 ist specified in the dictionary, no optimization is carried out during the storage on the database and an unlimited length is assumed.
Regards
Valter Oliveira.
09-15-2008 12:35 PM
09-15-2008 12:42 PM
Limit exists and it is 256 characters..
Raghav
Are you sure? Well, i'm storing in some database table entire big XML files (like our friend) with more than 2 thousand characters ... in only one string field!
Regards.
Valter Oliveira.
09-15-2008 1:21 PM
He's mixiing up characters and strings ot whatever. I was able to store an xml string with a length of over 50 mb.
09-15-2008 1:51 PM
I'll be very interested in how to get such data quantity, because, for any reason, I'm getting just 8192 char from the file and I'm losing a lot of info from that file.
09-15-2008 1:59 PM
Hello again.
Create a ztest program, and use this code. As you will see, var will get more than 17.000 characters, so the problem is not the type of variable you are storing. How are you assigning the value to it? Post your code ... perhaps that way we can help you!
DATA var TYPE string.
DO 20 TIMES.
CONCATENATE var
'Line1 - This is a test for testing the lenght of variables of type string'
'Line2 - This is a test for testing the lenght of variables of type string'
'Line3 - This is a test for testing the lenght of variables of type string'
'Line4 - This is a test for testing the lenght of variables of type string'
'Line5 - This is a test for testing the lenght of variables of type string'
'Line6 - This is a test for testing the lenght of variables of type string'
'Line7 - This is a test for testing the lenght of variables of type string'
'Line8 - This is a test for testing the lenght of variables of type string'
'Line9 - This is a test for testing the lenght of variables of type string'
'Line10 - This is a test for testing the lenght of variables of type string'
INTO var SEPARATED BY space.
ENDDO.
Regards,
Valter Oliveira.
p.s. - I'm not telling you to use CONCATENATE to upload XML files
Edited by: Valter Oliveira on Sep 15, 2008 2:04 PM
09-15-2008 2:27 PM
As you all may see, it's the code set in any previous thread with allows me to upload a binary file code up to get a XML. In spite the table line is set to (256 type x lenght), and there's an offset, even before of that it does not get the full file:
types: begin of ty_xml_line,
data(256) type x,
end of ty_xml_line.
data:
lv_ixml type ref to if_ixml,
lv_stream type ref to if_ixml_stream_factory,
lt_xml_table type table of ty_xml_line,
lv_xml_line type ty_xml_line,
lc_conv type ref to cl_abap_conv_in_ce,
lv_xml_table_size type i,
lv_len type i,
lv_len2 type i,
lt_tab type tsfixml,
lv_content type string,
lv_str1 type string.
* Generation of XML Stream.
clear: lv_ixml, lv_stream.
lv_ixml = cl_ixml=>create( ).
lv_stream = lv_ixml->create_stream_factory( ).
* File Generic Management.
open dataset p_fichero for input in binary mode.
if not sy-subrc is initial.
* call method me->escribir_log( ).
exit.
else.
do.
read dataset p_fichero into lv_xml_line.
if sy-subrc is initial.
append lv_xml_line to lt_xml_table.
else.
exit.
endif.
enddo.
close dataset p_fichero.
endif.
* Extract XML File Contents..
* Convert from HEX to XML..
describe table lt_xml_table.
lv_xml_table_size = ( sy-tleng ) * ( sy-tfill ).
loop at lt_xml_table into lv_xml_line.
lc_conv = cl_abap_conv_in_ce=>create( input = lv_xml_line-data
replacement = space
encoding = 'UTF-8' ).
lc_conv->read( importing data = lv_content len = lv_len ).
concatenate lv_str1 lv_content into lv_str1.
endloop.
lv_str1 = lv_str1+0(lv_xml_table_size).
split lv_str1 at cl_abap_char_utilities=>cr_lf into table pt_contenido.
loop at pt_contenido into lv_str1.
replace all occurrences of cl_abap_char_utilities=>horizontal_tab
in lv_str1 with space.
condense lv_str1.
endloop.
As said before, is a very standard code.
Best Regards.
09-15-2008 2:33 PM
Try replacing this:
types: begin of ty_xml_line,
data type xstring,
end of ty_xml_line.
I saw that CL_ABAP_CONV_IN_CE, method create, parameter input can catch xstring.
Also, what is the value of lv_xml_table_size?
Regards,
Valter Oliveira.
09-15-2008 2:57 PM
8192... it seems to be the full file but, as long as I upload and transform it, data dissapears.
09-15-2008 3:06 PM
Hi, Valter.
I tried to replace the x for the xstring data but an error appears when I try to execute the READ DATASET statement (err-mess: 'LV_XML_LINE cannot be a table, a reference, a string or contain any of these objects).
I'll keep on testing.
09-15-2008 3:06 PM
When you use DESCRIBE statement, it gives you 8192 chars, right? But that table is in HEX format. After that, you will convert it to normal string format (xstring to string) and this way the lenght will definitly change!
In debug, (more precisely in the LOOP), compare l_content with lv_xml-data. My point is, compare the old values with the new ones ... when you use CONCATENATE I believe no data is getting lost, but in convertion.
Regards,
Valter Oliveira.