Categories: ABAP Tutorials

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 .

Related Post

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.

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:

DATA:   l_v_spras         TYPE spras,
        l_v_codepage TYPE cpcodepage.   

l_v_spras = sy-langu. 

* Getting the Codepage value for connection Language   
CALL FUNCTION 'SCP_CODEPAGE_FOR_LANGUAGE'            
  EXPORTING                           
      language     =  l_v_spras            
  IMPORTING                            
      codepage    = l_v_codepage           
  EXCEPTIONS                           
      no_codepage = 1             
      OTHERS     = 2.   
IF sy-subrc  IS INITIAL.       
   WRITE l_v_codepage.   
ENDIF.

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

Share
Published by
John

Recent Posts

The Most Important SAP ISU Tables

SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…

December 22, 2020

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd Lecture

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…

November 18, 2020

The Main SAP Dunning Transaction Codes

Dunning is the business practice of informing a customer of past due payment. Dunning letters…

November 28, 2019

SAP Accounts Payable Tcodes & Accounts Receivable Tcodes ( SAP AP Tcodes & SAP AR Tcodes)

SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…

August 1, 2019

The Most Important SAP Payment Terms Tables (ZTERM, Text…)

What are the main SAP Payment Terms Tables ? What are the related Tables in…

October 21, 2018

The most Important SAP Work Center Tables in SAP PP

Work center consists of master data related to routing of products. It contains data related…

October 21, 2018