2007 Jun 18 4:28 PM
getting ABAP dump CONVT_CODEPAGE in ECC 6.0
While reading data from Unix file it is giving dump
I feel while transfering into Unix the data should be converted
how to convert the data?
The pseudo code is as shown below,
OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CHECK SY-SUBRC = 0.
loop at internale table.
transfer <internal table values> to outfile.
endloop.
CLOSE DATASET OUTFILE.
OPEN DATASET infile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
WRITE: / 'Could not open input file ', infile.
STOP.
ENDIF.
do.
READ DATASET infile INTO <workarea>.
enddo.
CLOSE DATASET infile.
2007 Dec 01 4:44 PM
Hi,
Did you get thte solution for this error? Please let me know. Thanks
2007 Dec 01 10:14 PM
Hello Sreedevi
Using static methods
CHECK_FOR_BOM
CHECK_UTF8
of class <b>CL_ABAP_FILE_UTILITIES</b> you should be able to find out the encoding of your Unix file (UTF16, little endian / big endian).
If the problem is indeed that the file is UTF16 whereas the OPEN DATASET expects UTF-8 you probably have to use class <b>CL_ABAP_CONV_IN_CE</b> (<i>Codepage & Endian conversion; External -> system format</i>).
I would assume that you need to read the file IN BINARY MODE and then use the method of the converter class to retrieve the appropriate encoding.
Finally, have a look at the blog
<a href="/people/ulrich.brink/blog/2005/08/18/unicode-file-handling-in-abap File Handling in ABAP</a>
Perhaps you will find another solution there.
Regards
Uwe
2007 Dec 05 1:06 PM
Hello,
If the sap system is set to UTF-16, you could also try a different solution.
Read the file in binary mode, into a field of type C with the exact length of one record (end-of-line not recognized in binary mode). If you do this, conversion from UTF-16 is done automatically. Than you can just move the C-field into the wanted structure. Note that the last 2 characters can be carriage return and line feed characters.
The same applies to writing a file: just write it in binary mode, and UTF-16 will be used if the system is set to use it.
Kind Regards,
Bart