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: 

SAP 4.6c Encoding UTF-8 CSV File into Application Server.

0 Kudos
1,274

Hi All,

I have a requirement that we need to save a CSV file into the application server in SAP 4.6c.

*This is for 4.6c so I don't have the encoding statement.

Below part of the code:

OPEN DATASET filepath FOR OUTPUT IN TEXT MODE.

LOOP AT lt_csv INTO ls_csv.

TRANSFER ls_csv2 to filepath.

ENDLOOP.

CLOSE DATASET filepath.

Every time I download this file the encoding is ANSI instead of UTF-8.

When I run the same program but for example, the company code is for USA the encoding automatically is UTF-8 instead of ANSI.

This change only happens for European/DACH company codes.

Thanks,

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos
418

UTF-8 is code page 4110. Do you have it in transaction code SCP?

If yes then use:

OPEN DATASET filepath FOR OUTPUT IN BINARY MODE CODE PAGE '4110'.

(in TEXT MODE is also possible in 4.6C because characters and bytes could be used interchangeably; I think your 4.6C system is not a Unicode system, right? -is it even possible-)

Concerning the company codes/countries, you don't explain what you exactly do, and how you verify that it's UTF-8 instead of ANSI (because both are identical in old systems). Each character being non-Unicode, is encoded in one byte (you're talking about USA/Europe so I think you don't talk about CJK/DBCS), so there are 256 possible characters, the 128 first characters are identical to the 128 first characters of UTF-8, characters after 128 are rare in US ASCII (ANSI), but more frequent in Europe for encoding accentuated characters.

matt
Active Contributor
0 Kudos
418

46C. Not in support.

Have you considered upgrading?

chaouki_akir
Contributor
0 Kudos
418

What is the name of the program that works fine for USA but not for Europe ?

How do you download the file from the application server (AL11) ?