Demystifying ABAP Code Page in SAP ( Tables and BAPI )

ABAP Code page determines how the systeme interprets  data and display the data.
In ABAP, you have to set the code page in order to handle the special characters. ( For exemple, in French é, è, à, ù, â, ê, î, ô, û, ë, ï, ç don’t exist in English keyboard.).

In this post, you will find the standard function to replace characters (the easy way ), then learn to get the Target ABAP Code Page for the country and a platform. Last thing is the standard CCC ABAP Conversion Classes.

Replace Caracters for non ABAP Code Page

You can simply remplace this special characters with the correspondant characters
with this function module SCP_REPLACE_STRANGE_CHARS
For exemple: é -> e .

Get target ABAP Code Page Conversion

Or you can handle the specific the ABAP code page of the connection language and the country.
Actuallay, there is a SAP table TCP0C matching the platform, the language, the country and the right code page.
Code Page table,abap code page

It is extremely helpfull if you manage file or text in non-EN language.

This sample abap code let you calculate the right code page to use:

Standart CCC Converter CL_ABAP_CONV_*

Since 6.10, you can also use the standard CCC converter classes CL_ABAP_CONV_*.
A good sample code can be find in this link.

  • CL_ABAP_CONV_IN_CE: converts bytes representing characters in a given codepage into a character or string variable
  • CL_ABAP_CONV_OUT_CE: converts a character or string variable into bytes representing characters in a given codepage
  • CL_ABAP_CONV_X2X_CE: converts bytes representing characters in a given codepage, into bytes representing characters in another given codepag

Sab125

Hi. I have been working as SAP Technical and functional for a decade. Through this blog, I am trying to share with you my experience. Hopefull, it makes your ways easier path ...Sab