SAP CODEPAGE FILE - Guide
Get Example source ABAP code based on a different SAP table
Code Pages for Files
ABAP_BACKGROUND
When you open text files on the
If the code page is not specified explicitly when a file is written, it is set implicitly (to UTF-8 in a Unicode system). If nothing is specified, a BOM is not set.
ABAP_RULE
Open text files for output explicitly in the UTF-8 code page. The byte order mark should be inserted and taken into account when the file is read.
ABAP_DETAILS
When a file is read, the code page used is usually very difficult to identify. However, if the byte-order mark is inserted, a file is clearly defined as a UTF-8. Therefore, you should always specify the
Exception
Files used for data exchange with applications that do not support UTF-8 format must be output in a suitable code page.
ABAP_EXAMPLE_BAD
The following source code shows how a text file is opened for writes without explicitly specifying the code page. In Unicode systems, UTF-8 is selected implicitly, but a byte order mark is not inserted.
FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.>
ABAP_EXAMPLE_END
ABAP_EXAMPLE_GOOD
The following source code shows how a text file is opened for writes by explicitly specifying the UTF-8 code page and using the byte order mark.
FOR OUTPUT IN TEXT MODE
ENCODING UTF-8 WITH BYTE-ORDER MARK.>
ABAP_EXAMPLE_END