‎2012 Aug 16 9:37 PM
Hello all,
I've been trying to convert a variable declared as xstring into TEXT, but after trying many function modules, I'm still without a solution.
My program reads an XLS file from BPC and the contents returns in a XSTRING variable. Since they need this file saved into the App.Server as CSV, I have to transform the spreadsheet into text first.
Any ideas?
Thanks.
JF
‎2012 Aug 16 11:52 PM
does the XSTRING only contain the content of your excel file, or does it contain the binary representation of the file itself? EG, does it have the excel file's metadata etc in it as well...
Have you tried calling method:
CL_ABAP_CONV_IN_CE=>CREATE
‎2012 Aug 17 3:10 AM
Hi Jorg,
this is the method called within function 'CONVERT_XSTRING_TO_TEXT', which I had already tried with no success.
Thanks,
Alex.
‎2012 Aug 17 5:03 AM
Hi,
check out this link
<link farm removed>
Hope it helps!
Message was edited by: Suhas Saha
‎2012 Aug 17 6:01 AM
Hiii,
Try this 2 FM - SCMS_XSTRING_TO_BINARY than SCMS_BINARY_TO_TEXT .
‎2012 Aug 17 6:49 AM
Hi
Julio
In My example shown below 'buffer' is the XSTRING, 'text_buffer' is the string. You have to supply an encoding to tell the system what codepage/unicode type the XSTRING is.
data: convin type ref to cl_abap_conv_in_ce,
call method cl_abap_conv_in_ce=>create
exporting
encoding = encoding
input = buffer
receiving
conv = convin.
call method convin->read
importing
data = text_buffer.
Please revert back.
Regards,
Aaradhana
‎2012 Aug 17 7:30 AM
JF,
as far as I see, you didn't answer Jorg's question
does the XSTRING only contain the content of your excel file, or does it contain the binary representation of the file itself?
This is crucial. It should be clear: if you upload an XLS or XLSX file to the server, you cannot simply use a character converter to transform the XSTRING representing this file into a string and expect a csv string as result. XLS is encoded in the BIFF format, whereas XLSX is a zipped OpenXML file. Both formats contain a lot of data, not only the cell contents.
For transforming an Excel file into a csv stringtab, the following steps are necessary:
If you answer Jorg's question, we can help you with specific classes or function modules that are doing this work for you.
Regards,
Rüdiger
‎2012 Aug 17 7:14 PM
Jorg/Rudger,
I'm not sure how to answer. These XLS files were probably uploaded to BPC so I would say it contains more than the cell contents.
Can you tell the steps to transform this XSTRING to the cell contents so I can create a CSV?
Thanks,
Alex.