Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

read .csv from server directory

former_member640793
Participant
0 Kudos

read .csv contents char, dats, unit etc from server directory.

i have using:

OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

...

READ DATASET file INTO my_structure.

dump to "read dataset":

exception = CX_SY_CONVERSION_CODEPAGE

During conversion of a text from code page '4110' to code page '4103', one of the following occurred: - Characters were discovered that cannot be displayed in one of the code pages - The conversion could not be performed for some other reason (see below for more details). Excerpt from the source buffer from the first character that could not be converted, displayed in hexadecimal form (with the ASCII characters in brackets): "82 CF 6E 01 00 00 04 05 00 00 13 00 08 02 5B 43 (..n...........[C)" The system was forced to terminate the current ABAP program 'ZTESTPROVA' since the conversion would have produced incorrect data. There are 50 of these non-convertible characters. If this number is 0, the second of the two scenarios described above applies.

thanks

3 REPLIES 3

FredericGirod
Active Contributor

Luca, I think you really need to start learning about using search functionality over internet. You will find the solution of most of your issus

1 answer of Google with the key work "OPEN DATASET CX_SY_CONVERSION_CODEPAGE"

https://answers.sap.com/questions/2547874/open-dataset-and-transfer-ittable-to-file-error-cx.html

Tomas_Buryanek
Active Contributor

I prefer to read files in BINARY MODE. And later convert if needed to text in specific code page.

In your case you would read dataset to xstring and after that convert it to string in code page of CSV file. We cannot tell which one, but probably UTF-8 (that depends on the provider who provides/creates that file).

Handy methods to conversion are in cl_bcs_convert (method xstring to string in this case).

-- Tomas --

Maybe this character-set recognition tool can help.