‎2007 Sep 29 9:49 AM
Hello ,
I have file with mixed text format ie. normat text and Unicode text format.
My file extension is .txt only but having different fomats.
This file is having employees information like emp.number, grade etc in normal text format and there is one huge text field(having employee evaluation data) having text in unicode format.
1. How to read this text?
2. I would like to upload this data into tables.
Please help me to find the possible scenarios.
Any help greatly appreciated.
For example my file looks like this...
10 70869
feff005400680069007300200069007300200054006500730074002000440061007400610020006f
10 70887
feff005400680069007300200069007300200054006500730074002000440061007400610020006f
Waiting for your help.
Regards,
John
‎2007 Sep 29 10:16 PM
If you are able to identify exactly where the unicode/non-unicode are, you just have to use 2 or 3 objects, see here first the 3 abap oo classes: http://help.sap.com/saphelp_nw70/helpdata/en/79/c554afb3dc11d5993800508b6b8b11/frameset.htm
Then look at the class documentation in SE24 transaction for these 3 classes.
IF YOU WANT TO CONVERT EVERYTHING IN abap characters (TYPE C), you have to do it this way:
1) convert file ascii parts (page code 1100) into abap characters
2) convert file unicode 16 parts (big endian? = page code 4102) into abap characters
Example which converts unicode 16 big endian x'0041' into an abap character
REPORT Z_UNICODE_ASCII.
DATA e type ref to cx_root.
DATA unicode_2_abap TYPE REF TO cl_abap_conv_in_ce.
DATA unicode_a(2) TYPE x.
DATA char_a(1) TYPE c.
unicode_a = '0041'.
TRY.
unicode_2_abap = cl_abap_conv_in_ce=>create(
encoding = '4102' "Unicode 16BE, see table TCP00
).
CATCH cx_root INTO e.
WRITE 'err'.
ENDTRY.
* Determine letter which corresponds to X'0041'
TRY.
unicode_2_abap->convert(
EXPORTING input = unicode_a
IMPORTING data = char_a ).
CATCH cx_root INTO e.
WRITE 'err'.
ENDTRY.
write char_a.About how to upload, you can use CL_GUI_FRONTEND_SERVICES=>gui_upload. You can upload the file in binary mode (into an XSTRING variable), it will be more simple. See method documentation.