Application Development and Automation 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 only

Error while reading excel file from application server into internal table.

Former Member
0 Likes
1,851

Hi experts,

My requirement is to read an excel file from application server into internal table.

Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).

Now in my program I have used :

OPEN DATASET v_filename FOR INPUT IN text mode encoding default.

DO.

READ DATASET v_filename INTO wa_tab.

......................................

The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.

Error details:

A character set conversion is not possible.

At the conversion of a text from codepage '4110' to codepage '4103':

- a character was found that cannot be displayed in one of the two

codepages;

- or it was detected that this conversion is not supported

The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion

would have produced incorrect data.

The number of characters that could not be displayed (and therefore not

be converted), is 445. If this number is 0, the second error case, as

mentioned above, has occurred.

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

Characters are always displayed in only a certain codepage. Many

codepages only define a limited set of characters. If a text from a

codepage should be converted into another codepage, and if this text

contains characters that are not defined in one of the two codepages, a

conversion error occurs.

Moreover, a conversion error can occur if one of the needed codepages

'4110' or '4103' is not known to the system.

If the conversion error occurred at read or write of screen, the file

name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about

the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")

Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .

Regards,

Karthik

3 REPLIES 3
Read only

Former Member
0 Likes
895

Try saving the file as "Tab delimited" with .xls extension and then move it to application server.

Read only

0 Likes
895

Hi,

Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.

As I think you are uploading the file in BIN format to Application server and trying to open text file.

Regards,

Umang Mehta

Read only

0 Likes
895

Hi All,

I got the solution.

The function module FILE_READ_AND_CONVERT_SAP_DATA has to be used.

Regards,

Karthik