Skip to Content
Author's profile photo Martin Vierling

Unicode Character and SAP Standard Interfaces based on RFC

Hi,

sometimes it happens when connecting “legacy” SAP integrations to new SAP systems based on Unicode that only garbage is transferred. For example when you are using SAP Standard Interface using SAP’s RFC protocol, e.g. for IDOC or BAPI processing (see http://www.sdn.sap.com/irj/sdn/icc -> All Integration Scenarios).

Regarding RFC between Unicode-Systems and None-Unicode Systems:

SAP Systems are separated in type none-Unicode and Unicode.
You can use both librfc and librfcu to interact with both type of systems.
Limitations:
Usage of librfc together with Unicode system / Usage of librfc together with none-Unicode system: you need to ensure that only characters are transferred that are included in the target-code page. Again when using librfc or librfcu target-code page is dependent to operations system (see also below). For more details about RFC-API see:
Documentation RFC API  http://help.sap.com/saphelp_nw70/helpdata/EN/22/04280f488911d189490000e829fbbd/frameset.htm
RFC and Unicode http://help.sap.com/saphelp_nw70/helpdata/EN/79/c554b2b3dc11d5993800508b6b8b11/frameset.htm

You have always to distinguish between the different abstraction layers of a SAP system:

– Operating System + SAP Kernel

– SAP System Application Server(s)

– SAP Database

– Communication protocols, e.g. for RFC

 

When using the RFC Libraries usually you are using the data-types and codepage of the local environment (see RFC API documentation for departures).

Sending data to the SAP system the data are transferred automatically to target codepage without any interaction.

Please take care of SAP Note 1021459 – Conversion behavior of the RFC library (http://service.sap.com/notes).
Please set environment variabales in OS of source system as describes in SAP note.
e.g. OS envirnment variable for Shift-JIS “SAP_CODEPAGE = 8000”.

 

On destination the codepage of the SAP System will be used. See SAP Note 552464. Excerpt:
Codepage   Short-name                                                 Plattform
1100          SAP internal, like ISO 8859-1                        SAP non Unicode systemes
4102          UTF-16BE Unicode / ISO/IEC 10646              SAP Unicode on most Unix
4103          UTF-16LE Unicode / ISO/IEC 10646               SAP Unicode on x86
8000          Shift JIS (based on Microsoft CP932)             SAP DBCS Japanese

 

Regarding Non-Unicode SAP codepages:

Languages that use the same code page can be used together without restriction. For more detailed information see http://help.sap.com/erp2005_ehp_04/helpdata/EN/c1/ae563cd2ad4f0ce10000000a11402f/frameset.htm.

 

More Details:

– SAP Note 647495 and Notes referenced in SAP Note 647495. To read SAP Notes please use page “http://service.sap.com/notes

http://help.sap.com/saphelp_nw04/helpdata/en/22/5a981cfbaa06428abdfa32b81423d2/frameset.htm

(abbreviation MDMP means: Multi-Display/Multi-Processing)

 

Example:
1.
I filled a string with Shift-JIS code:
    Japanese Text: Japan Char (just some easy characters)
    Related Shift-JIS code: 8A43 96D8 97D1 9058 8AD4 93FA 8D87 967B 89A4
    (see http://www.rikai.com/library/kanjitables/kanji_codes.sjis.shtml for code-relation)

2a.
I did RFC-call without environment variable SAP_CODEPAGE = 8000
Result for message-text is: “#C#Ø#Ñ#X#Ô#ú###{#¤”

2b.
Using “set SAP_CODEPAGE=8000” to set environment and doing same RFC-call again
Result for message-text is: “Japan Char

3.
Excerpt from RFC-Trace:

Without SAP_CODEPAGE=8000

>>> RfcOpenEx …
 Got following connect_param string:
   TYPE=3 TRACE=3 CLIENT=800 USER=****** PASSWD=******* LANG=EN DEST=CF5
 Got following contents from saprfc.ini:
   DEST=CF5 TYPE=A ASHOST=cpcf501 SYSNR=05 RFC_TRACE=1
Send RFCHEADER: 01/LIT/IEEE/SPACE/1100
Send UNICODE-RFCHEADER: cp:1100/ce:IGNORE/te:REJECT/cs:1/rc:0x00000023

With SAP_CODEPAGE=8000

>>> RfcOpenEx …
 Got following connect_param string:
   TYPE=3 TRACE=3 CLIENT=800 USER=****** PASSWD=******* LANG=EN DEST=CF5
 Got following contents from saprfc.ini:
   DEST=CF5 TYPE=A ASHOST=cpcf501 SYSNR=05 RFC_TRACE=1
Send RFCHEADER: 01/LIT/IEEE/SPACE/8000
Send UNICODE-RFCHEADER: cp:8000/ce:IGNORE/te:REJECT/cs:1/rc:0x00000023

Payload each time:


0002f0 | 00000000 00000000 8A4396D8 97D19058 |………C…..X|
000300 | 8AD493FA 8D87967B 89A42003 04FFFF00 |…….{.. …..|
000310 | 00FFFF00 00000000 00000000 00000000 |…………….|

 

Hope this help to answer your questions. 

Martin Vierling

SAP Integration and Certification Center (SAP ICC)

Global Ecosystem & Partner Group

SAP AG

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.