Top Banner
Session ID: SPC251 Unicode Interfaces – Data Exchange Between Unicode and non-Unicode Systems
69

Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

Mar 16, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

Session ID SPC251Unicode Interfaces ndashData Exchange BetweenUnicode and non-UnicodeSystems

Dr Christian Hansen SAP AG

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

Communication The Ideal Picture

Communication The Reality

Part I ndash RFC SAP R3 SAP R3Unicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises I

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Part IV RFC SAP R3 RFC clientUnicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

About Code Pages Conventional Code Pages

Disadvantages of old standard code pagesEach covers only a subset of all characters usedIncompatibilities between different codepagesOnly restricted data exchange possibleToo many of them

CanonKYOCERA

APPLE

IS0-9

IS0-2IS0-3

IS0-5

12IS0-71250

1251

1252

HPIBM

IS0-9

IS0-2IS0-3

EBCDIC

12IS0-7

6970277697

05001252

1256

IS0-2IS0-3

1257

1254

12501251

1252

Mircosoft

ASCII

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1 SAPLanguages 41

Characters 22378

Code Pages 390

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

English

German

Turkish

DanishDutch

FinnishFrench Italian

NorwegianPortugueseSpanish

Swedish

CroatianCzechHungarianPolish

RumanianSlovakian

Slovene

RussianUkrainian

Greek

Hebrew

Thai

Korean

Japanese Chinese

Taiwanese

Icel

andi

c

And morelanguagescan besupportedeasilywithout theneed fornew code

pages orother new

methods

Solution Unicode one Code Page for all Scripts

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

ASCIIGeneral Scripts

Symbols

CJK Ideographs

Hangul

Compatibility

Surrogate Area

65000 characters

Additional1000000 characters

Solution Unicode characters

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 2: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

Dr Christian Hansen SAP AG

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

Communication The Ideal Picture

Communication The Reality

Part I ndash RFC SAP R3 SAP R3Unicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises I

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Part IV RFC SAP R3 RFC clientUnicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

About Code Pages Conventional Code Pages

Disadvantages of old standard code pagesEach covers only a subset of all characters usedIncompatibilities between different codepagesOnly restricted data exchange possibleToo many of them

CanonKYOCERA

APPLE

IS0-9

IS0-2IS0-3

IS0-5

12IS0-71250

1251

1252

HPIBM

IS0-9

IS0-2IS0-3

EBCDIC

12IS0-7

6970277697

05001252

1256

IS0-2IS0-3

1257

1254

12501251

1252

Mircosoft

ASCII

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1 SAPLanguages 41

Characters 22378

Code Pages 390

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

English

German

Turkish

DanishDutch

FinnishFrench Italian

NorwegianPortugueseSpanish

Swedish

CroatianCzechHungarianPolish

RumanianSlovakian

Slovene

RussianUkrainian

Greek

Hebrew

Thai

Korean

Japanese Chinese

Taiwanese

Icel

andi

c

And morelanguagescan besupportedeasilywithout theneed fornew code

pages orother new

methods

Solution Unicode one Code Page for all Scripts

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

ASCIIGeneral Scripts

Symbols

CJK Ideographs

Hangul

Compatibility

Surrogate Area

65000 characters

Additional1000000 characters

Solution Unicode characters

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 3: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

Communication The Ideal Picture

Communication The Reality

Part I ndash RFC SAP R3 SAP R3Unicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises I

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Part IV RFC SAP R3 RFC clientUnicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

About Code Pages Conventional Code Pages

Disadvantages of old standard code pagesEach covers only a subset of all characters usedIncompatibilities between different codepagesOnly restricted data exchange possibleToo many of them

CanonKYOCERA

APPLE

IS0-9

IS0-2IS0-3

IS0-5

12IS0-71250

1251

1252

HPIBM

IS0-9

IS0-2IS0-3

EBCDIC

12IS0-7

6970277697

05001252

1256

IS0-2IS0-3

1257

1254

12501251

1252

Mircosoft

ASCII

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1 SAPLanguages 41

Characters 22378

Code Pages 390

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

English

German

Turkish

DanishDutch

FinnishFrench Italian

NorwegianPortugueseSpanish

Swedish

CroatianCzechHungarianPolish

RumanianSlovakian

Slovene

RussianUkrainian

Greek

Hebrew

Thai

Korean

Japanese Chinese

Taiwanese

Icel

andi

c

And morelanguagescan besupportedeasilywithout theneed fornew code

pages orother new

methods

Solution Unicode one Code Page for all Scripts

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

ASCIIGeneral Scripts

Symbols

CJK Ideographs

Hangul

Compatibility

Surrogate Area

65000 characters

Additional1000000 characters

Solution Unicode characters

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 4: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Part IV RFC SAP R3 RFC clientUnicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

About Code Pages Conventional Code Pages

Disadvantages of old standard code pagesEach covers only a subset of all characters usedIncompatibilities between different codepagesOnly restricted data exchange possibleToo many of them

CanonKYOCERA

APPLE

IS0-9

IS0-2IS0-3

IS0-5

12IS0-71250

1251

1252

HPIBM

IS0-9

IS0-2IS0-3

EBCDIC

12IS0-7

6970277697

05001252

1256

IS0-2IS0-3

1257

1254

12501251

1252

Mircosoft

ASCII

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1 SAPLanguages 41

Characters 22378

Code Pages 390

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

English

German

Turkish

DanishDutch

FinnishFrench Italian

NorwegianPortugueseSpanish

Swedish

CroatianCzechHungarianPolish

RumanianSlovakian

Slovene

RussianUkrainian

Greek

Hebrew

Thai

Korean

Japanese Chinese

Taiwanese

Icel

andi

c

And morelanguagescan besupportedeasilywithout theneed fornew code

pages orother new

methods

Solution Unicode one Code Page for all Scripts

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

ASCIIGeneral Scripts

Symbols

CJK Ideographs

Hangul

Compatibility

Surrogate Area

65000 characters

Additional1000000 characters

Solution Unicode characters

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 5: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

About Code Pages Conventional Code Pages

Disadvantages of old standard code pagesEach covers only a subset of all characters usedIncompatibilities between different codepagesOnly restricted data exchange possibleToo many of them

CanonKYOCERA

APPLE

IS0-9

IS0-2IS0-3

IS0-5

12IS0-71250

1251

1252

HPIBM

IS0-9

IS0-2IS0-3

EBCDIC

12IS0-7

6970277697

05001252

1256

IS0-2IS0-3

1257

1254

12501251

1252

Mircosoft

ASCII

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1

BIG-5

SJISIS0-9

IS0-2IS0-3

IS0-5

IS0-6IS0-7IS0-8

IS0-4

IS0-1 SAPLanguages 41

Characters 22378

Code Pages 390

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

English

German

Turkish

DanishDutch

FinnishFrench Italian

NorwegianPortugueseSpanish

Swedish

CroatianCzechHungarianPolish

RumanianSlovakian

Slovene

RussianUkrainian

Greek

Hebrew

Thai

Korean

Japanese Chinese

Taiwanese

Icel

andi

c

And morelanguagescan besupportedeasilywithout theneed fornew code

pages orother new

methods

Solution Unicode one Code Page for all Scripts

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

ASCIIGeneral Scripts

Symbols

CJK Ideographs

Hangul

Compatibility

Surrogate Area

65000 characters

Additional1000000 characters

Solution Unicode characters

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 6: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

English

German

Turkish

DanishDutch

FinnishFrench Italian

NorwegianPortugueseSpanish

Swedish

CroatianCzechHungarianPolish

RumanianSlovakian

Slovene

RussianUkrainian

Greek

Hebrew

Thai

Korean

Japanese Chinese

Taiwanese

Icel

andi

c

And morelanguagescan besupportedeasilywithout theneed fornew code

pages orother new

methods

Solution Unicode one Code Page for all Scripts

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

ASCIIGeneral Scripts

Symbols

CJK Ideographs

Hangul

Compatibility

Surrogate Area

65000 characters

Additional1000000 characters

Solution Unicode characters

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 7: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

ASCIIGeneral Scripts

Symbols

CJK Ideographs

Hangul

Compatibility

Surrogate Area

65000 characters

Additional1000000 characters

Solution Unicode characters

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 8: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4auml6161 0000 61U+0061a

UTF-8UTF-16little endian

UTF-16big endian

Unicodescalar value

Character

Representation of Unicode Characters

UTF-16 ndash Unicode Transformation Format 16 bit encodingFixed length 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)Platform-dependent byte order (biglittle endian)2 byte alignment restriction

UTF-8 ndash Unicode Transformation Format 8 bit encodingVariable length 1 character = 14 bytesPlatform independentno alignment restriction7 bit US ASCII compatible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 9: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

Check your system type with report RSCPINST current configuration

West European View Japanese View Korean View

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 10: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Old solution for multiple languages MDMP

West European View Japanese View Korean View

End of support withNetWeaver lsquo04

(see notes 838402 and 79991)

(As of release NetWeaver 04s and moving forward MDMP will no longer be supported)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 11: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only supported solution for multilingual systems Unicode

UnicodeUnicode

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 12: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade the integration platform

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 13: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 14: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

noEvolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 15: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

noSAP NetWeavertrade

Com

posi

te A

pplic

atio

n Fr

amew

ork

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 16: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SAP NetWeavertrade with non-Unicode ABAP stack

no

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

nono

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

non-Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 17: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Only solution for full integration Unicode

yes

yes

yes

Evolution of mySAP Technology

Unifies and aligns peopleinformation and business processes

Integrates across technologies andorganizational boundaries

A safe choice with full NET and J2EEinteroperability

The business foundation for SAPand partners

Powers business-ready solutionsthat reduce custom integration

Its Enterprise Services Architectureincreases business process flexibility

SAP NetWeavertradeC

ompo

site

App

licat

ion

Fram

ewor

k

PEOPLE INTEGRATION

Multi channel access

Portal Collaboration

INFORMATION INTEGRATION

Bus Intelligence

Master Data Mgmt

Knowledge Mgmt

PROCESS INTEGRATION

IntegrationBroker

BusinessProcess Mgmt

APPLICATION PLATFORM

J2EE

DB and OS Abstraction

Unicode ABAPLife-C

acleM

gmt

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 18: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication The Ideal Picture

The ideal Picture only Unicode components

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client(SAP_UC)

JAVAApplication

(Portal)Conversions are donealgorythmically (11relation)No datamisinterpretationNo data lossAll business relevantcharacters available atthe same time

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 19: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication Reality

R3 46C

3rd PartyEBCDIC

mySAP BWISO8859-1

R3 Enterprise

BIG-5SJIS

IS0-8IS0-1 1251

IS0-9

IS0-2IS0-3IS0-7

6970277

6970500

1252

Files

ISO8859-1SJIS

charset=iso-8859-1 gtcharset=windows-1257 gt

charset=utf-8 gtcharset=Shift_JIS gt

Internet

RFC Client(char)

SAP_CODEPAGE= 1100

JAVAApplication

(Portal)

The reality Unicode and non-Unicode components

Conversions betweenincompatible codepages everywhereOnly common subsetexchangeableSpecial rules have to beobeyed to makecommunicationpossible

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 20: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 21: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode Unicode combination RFC passes all characterdata without code page conversion or merely with adaption of theendianness

bull UTF-16 big endian = SAP code page 4102bull UTF-16 little endian = SAP code page 4103

Information about the destination is maintained in SM59special options character width in target system

bull 1 Byte = non-Unicodebull 2 Byte = Unicode

RFC Unicode Unicode

R3 Enterprise R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 22: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode single code page combinationRFC passes all character data with code page conversion betweenUnicode and the old code page

As Unicode is a true superset of any old standard codepage not allUnicode characters can be transfered to the non-Unicode system

Auml Aumlszlig szlig

RFC Unicode non-Unicode single code page

R3 46CISO8859-1

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 23: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

In case of an Unicode non-Unicode MDMP combination RFC passesall character data with code page conversion between Unicode and thedifferent old code pages

Which of the MDMP code pages is choosen depends on the language

Auml DE Aumlszlig DE szlig

JAJA

JA JA

RFC Unicode non-Unicode MDMP

R3 46CISO8859-1

SJIS

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 24: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquodata types

Flat C N D T X I F P andany structure consisting only of these fields

Deep STRING XSTRING table types object references andany structure containing one of these types

Deep data types are transferred using an UTF-8 encoded XMLformat (XRFC)

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 25: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Excursion Difference between ldquoflatldquo and ldquodeepldquo datatypes

Detailed conversion paths

Deep data Unicode XML UTF-8 target code page

Flat data Unicode target code page

Deep data Unicode XML UTF-8 source code page

Flat data Unicode source code page

Unicode system Non-Unicode system

non-Unicode compatiblesource code page

non-Unicode compatibletarget code page

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 26: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages a) Data without text language field

Example Flat data logon language German

Auml Logon = DE AumlLogon = DE

Sourcesystem

Datatype

Source codepage

Intermediateformat

Target codepage

UnicodeFlat

Unicode

Logon languagesource system Logon language

target systemDeepUTF-8 based XML

non-Unicode

Flat Logon languagesource system

Logon languagesource system

UnicodeDeep UTF-8 based XML

XML non-Uniocde compatible code page You may switch to ldquoLogon language target systemrdquo using RFC bit option 0x200 at SM59 Special options RFC Bit Options

SY-LANGUsource system

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 27: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Flat Structures containing a language field (domain SPRAS DDIC data typeLANG) with maintained text language flag have a special handling

For TABLES parameters automatic language code pageassignment is done during RFC for each row independent of logonlanguage

This enables sending and and receiving tables from MDMP systems(different code pages for each row)

Auml Logon = DE text language = DE AumlLogon = DE text language = JA

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 28: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC Unicode non-Unicode MDMP

Deriving code pages b) Data (flat) with text language field

Automatic code page assignment is activatedconfigured by thefollowing actions in the Unicode system

Maintaining text language flag with SE11Maintaining language code page assignment with SM59 for outgoingcallsMaintaining language code page assignment for incoming calls fromlegacy systems that donlsquot pass their code page information with a proforma destination (note 722193)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 29: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Maintain RFC destination SM59 MDMP settings

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 30: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

SE11 Maintain text language flag

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 31: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Deriving code pages b) Data (flat) with text language field

Frequent problem data with invalid or unknown text language

Auml text language = DE Aumltext language = JA

Ouml text language = eacuteAcirc runtime error RFC_CONVERSION_TABLEszlig text language = ES runtime error RFC_CONVERSION_TABLE

If it is not possible to delete the wrong or obsolete data in the sourcesystem proceed as described in the note 809279 ldquoRFC non-Unicode toUnicode with unknown text languagerdquo

RFC Unicode non-Unicode MDMP

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 32: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 33: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application server

Pattern for writingreading files on the application server

OPEN DATASET IN ltmodusgt MODETRANSFERREADCLOSE DATASET

ltmodusgt

BINARY MODEUninterpreted sequence of bytesTEXT MODE ENCODING UTF-8 NON-UNICODE DEFAULTPure unstructured text data DEFAULT equals UTF-8 in Unicodesystems and NON-UNICODE in non-Unicode systemsLEGACY TEXTBINARY MODEProduces an format compatible to non-Unicode systems Text data is alwayswritten in NON-UNICODE format Not character-like structures are allowed Theonly difference between TEXT and BINARY is that in case of TEXT an EOF (ENDOF FILE) marker is added

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 34: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Code page selection NON-UNICODE

If during data transfer a Unicode non-Unicode conversion isneccessary the non-Unicode code page is derived from the currentsystem language SY-LANGU which may be changed by using SETLOCALE LANGUAGE ltlanggt

Advantages and disadvantages for data exchangeBINARY Not a good exchange format in itself Use this forwritingreading prepared data of well known format (eg XML UTF-8 asXSTRING) or use for writeread on the same application serverTEXT MODE UTF-8 is a good exchange format Structures may not betransfered as a whole Only single fieldsLEGACY MODES Only for reading or writing non-Unicode dataStructure and code page information is considered

File transfer Application server

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 35: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 1 BINARY MODE

R3ISO8859-1

SJIS1100

8000

BINARY MODE

BINARY MODELEGACYBINARY MODE

SY-LANGU

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 36: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 2 TEXT MODE UTF-8

R3ISO8859-1

SJISTEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

TEXT MODE UTF-8 TEXT MODE UTF-8

SY-LANGU

Full charset supported (no data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 37: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 3 TEXT MODE NON-UNICODE

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODENON-UNICODE

SY-LANGU

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE

TEXT MODENON-UNICODE1100

8000

1100

8000

Only part of UC charset supported (possible data loss in the file)

Structured data as a whole write field by field =

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 38: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 4 TEXT MODE DEFAULT

R3ISO8859-1

SJIS

SY-LANGU

TEXT MODEDEFAULT

SY-LANGU

1100

8000

TEXT MODENON-UNICODE

TEXT MODEDEFAULT

TEXT MODEUTF-8

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 39: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 5 LEGACY TEXTBINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

LEGACY TEXTBINARY MODE

SY-LANGU

1100

8000

1100

8000

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

LEGACY TEXTBINARY MODE

Only part of UC charset supported (possible data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 40: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Using XML as transport format

Use CALL TRANSFORMATION with target data type XSTRING to create anUTF-8 based XML representation of your data

Structure information (nolayout alignmentproblems)UTF-8 based (no data loss)Transport in binary form

File transfer Using XML

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 41: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Example 6 UTF-8 based XML + BINARY MODE

R3ISO8859-1

SJIS

SY-LANGU

CALLTRANSFORMATION+ BINARY MODE

BINARY MODE +CALLTRANSFORMATION

CALLTRANSFORMATION+ BINARY MODE

SY-LANGU

BINARY MODE +CALLTRANSFORMATION

Full charset supported (no data loss in the file)

Structured data

File transfer Application server

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 42: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks I

The only Unicode Format supported with OPEN DATASET is UTF-8UTF-16 is not supportedIf you still need to read Unicode and non-Unicode files at the same timeyou have to provide users the chance to select the outside code page(see note 752835 Usage of the file interfaces in Unicode systems) OPENDATASET ENCODING DEFAULT does not do it for you

As workaround for missing selection possibilities you may want toconvert the files on the file system prior to loading them For thispurpose you may use the following tools

sapiconv note 752859RSCP_CONVERT_FILE note 747615

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 43: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Application Server

Additional Remarks II Byte Order Mark (BOM)

Byte-Order-Marks (BOM U+FEFF) are used to indicate the encodingof Unicode files and and are not part of the file content

SAPs recommendationAutomatically detect UTF-8 encoded files withCL_ABAP_FILE_UTILITIES=gtCHECK_FOR_BOMRead UTF-8 files withOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR INPUTSKIPPING BYTE ORDER MARKWrite files always with BOMOPEN DATASET IN TEXT MODE ENCODING UTF-8 FOR OUTPUT WITHBYTE ORDER MARK

See also SDN Weblog httpsweblogssdnsapcompubwlg2194

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 44: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

File transfer Frontend

File transfer at the frontend with GUI_UPDOWNLOAD

The function modules GUI_UPDOWNLOAD convert data into textualrepresentation Structures are allowed

Determination of the outside code page

Front end code page matching to the current system code page (SY-LANGU SET LOCALE LANGUAGE)Declared explicitly with optional parameter CODEPAGE (Starting withrelease 620 SP 21)In interactive mode useCL_GUI_FRONTEND_SERVICES=gtFILE_OPENSAVE_DIALOG(parameter WITH_ENCODING = lsquoXrsquo) to select the code page(only SAPGUI 640)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 45: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

cl_gui_frontend_services=gtfile_opensave_dialog

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 46: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Change default Encodingfor UploadDownload

SAP Logon PropertiesAdvanced

File transfer Frontend

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 47: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

RFC and file transfer from a Unicode systems perspective

Overview RFC and File transfer

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 48: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 49: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Things you should never do

Type hiding

Missing text language field

Wrong length assumptions

Sending data that is not in the receivers codepage

Common mistakes overview

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 50: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Dont hide types 1If you conceal the true types from the system the system cannot anything for youAs a consequence data may for example be subject to unwanted codepageconversions

Example Transporting binary data in character containers

Common mistakes Type hiding binary data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 51: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Common mistakes Type hiding characterlike data

Dont hide types 2Even sending a pure characterlike structure in a character container concealsimportant information ndash the field boundaries ndash from the system

Example Transporting characterlike data in character containers

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 52: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

0 0 F F 0 0

Workaround if container approach cannot be changed

Use CL_NLS_STRUC_CONTAINER to correct the implicit layout

NAME RGB Value

0 0 F F 0 0

0 0 F F 0 0

0 0 F F 0 0

Unicodesystem

Non-Unicodesystem

RFC

struc_to_cont

cont_to_strucstruc_to_cont

cont_to_struc

Datacontainer

Common mistakes Type hiding characterlike data

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 53: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Always use text language fieldsIn principle you must not send any data without text language if the data containsnon 7 bit ASCII characters Otherwise corruption of the data is the result

Example Sending non Latin 1 data without text language field by RFC (Germanlogon)

Common mistakes Missing text language field

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 54: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptionsString lengths are not invariant under code page conversions This maylead to different problems

In a Unicode system a character field of certain length can hold morecharacters than the same character field in a non-Unicode systemSending such data will result in data loss ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 55: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Problems with length assumptions (continued)

Breaking a string into a table of fixed line size and sending the table from anon-Unicode to a Unicode-system does not work since the informationabout the occupied length is lost and subsequent reassembling into astring will insert unwanted spaces ( )

Common mistakes Wrong length assumptions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 56: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Data not in the receivers code page

In general you must not send data from a source system into a target system if thecharacters send are not in the target systems code page Especially donlsquot send oneof the characters that are only in the Unicode code page to an old-fashioned non-Unicode system

Try to send a white smiling face ( ) or a black smiling face ( ) orsome beamed eigth notes ( ) ( )

Common mistakes data not in receivers codepage

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 57: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

IntroductionAbout Code Pages

The Ideal Picture

Reality

Part I ndash RFCUnicode Unicode

Unicode single code page system

Unicode MDMP system

Part II ndash File transferWriting and reading files on the application server

Writing and reading files on the front end

Part III ndash Common mistakes

Exercises

Contents

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 58: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Exercises

Send single code page and MDMP data via RFCType hiding and missing text language fieldsTECHED_UNICODE_EXERCISE_11121314 and15Wrong length assumptionsTECHED_UNICODE_EXERCISE_1618Data not in the receivers code pageTECHED_UNICODE_EXERCISE_17

Transfer data via file on the application serverWriting files TECHED_UNICODE_EXERCISE_19Reading files TECHED_UNICODE_EXERCISE_20BOM handling TECHED_UNICODE_EXERCISE_23

Transfer data via file on the frontendWriting files TECHED_UNICODE_EXERCISE_21Reading files TECHED_UNICODE_EXERCISE_22

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 59: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Appendix

RFC SAP R3 RFC client Unicode interface for C programming

Other languages

Agenda

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 60: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

The ideal Picture RFC Clients

When I want toUnicode enable myRFC client

what shall I do withtype char

R3 Enterprise

3rd Party

mySAP BW

R3 Enterprise

FilesInternet

RFC Client()

JAVAApplication

(Portal)

RFC SAP R3 RFC client

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 61: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

httpservicesapcomnetweaver

SAP NetWeaver

SAP NetWeaver in Detail

Application Platform

Connectivity

Connectors

RFC Library

Media Library

RFC Library Guide (PDF)

Section RFC Library and UNICODE

What you need ndash Unicode RFC SDK

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 62: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Communication with Java via JCoJRFC

Java uses Unicode Unicode R3 makes live easier

For JCo server it is necessary to specify if partners are UnicodeJCoServersetProperty(jcoserverunicode1)

JCo server needs different repository for Unicode and non-Unicodepartners

One JCoServer Object can only serve Unicode or non-Unicodepartners

This restriction does not exist for JRFC (JCo successor for J2EEapplications)

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 63: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

non-UnicodeRFC

direct or viawdt ocx

Unicode=gt

RFC partnercode page

VisualBasic

Windowsdefault

code page=gt

Unicode

Data transfer is restricted to Windows default code page

RFC partner code page must match to Windows default code page

Communication with Visual Basic (1)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 64: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

UnicodeRFC

direct or viawdtU ocx

UnicodeVisualBasic

Unicode

With Unicode RFC Unicode wdt ocx no code page conversionneeded

Standard Visual Basic UI controls do not support UnicodeMS Office controls do

Communication with Visual Basic (2)

R3 Enterprise

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 65: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Visual Basic NET uses Unicode

Via NET Connector communication with Unicode and non-Unicodepartners possible (transparent for caller)

Communication with Visual Basic NET

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 66: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Public WebhttpwwwservicesapcomUnicodesap TechnologyhttpwwwservicesapcomUnicode Customer contactwwwsdnsapcomsdndevelopersguidesdn NetWeaver Developerlsquos Guide

Related WorkshopsLectures at SAP TechEd 2005SPC202 Conversion of SAP Systems to Unicode lectureSPC204 Performance Techniques for Unicode Conversion of Single Code

Page Systems lecture (Teched Boston only)LCM207 SAP Upgrade and Unicode Methodology (Teched Boston only)SPC251 Unicode Interfaces ndash Data Exchange Between Unicode and non-

Unicode Systems hands onSPC250 Making ABAP Programs Unicode Enabled hands onIM101 Dealing with Multi-Language Garbage Data ndash Lessons Learned

lecture

Related SAP Education Training Opportunitieshttpwwwservicesapcomrkt-unicode

Further Information

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 67: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

QampA

Questions

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 68: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

Please complete your session evaluation

Be courteous mdash deposit your trashand do not take the handouts for the following session

Feedback

Thank You

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved

Page 69: Session ID: SPC251 Unicode Interfaces – Unicode and non ... · ¤SAP AG 2005, SAP TechEd ’05 / Session ID / SPC251 In case of an Unicode ÅÆnon-Unicode single code page combination,

SAP AG 2005 SAP TechEd rsquo05 Session ID SPC251

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG The informationcontained herein may be changed without prior noticeSome software products marketed by SAP AG and its distributors contain proprietary software components of other software vendorsMicrosoft Windows Outlook and PowerPoint are registered trademarks of Microsoft CorporationIBM DB2 DB2 Universal Database OS2 Parallel Sysplex MVSESA AIX S390 AS400 OS390 OS400 iSeries pSeries xSeries zSeries zOS AFPIntelligent Miner WebSphere Netfinity Tivoli and Informix are trademarks or registered trademarks of IBM CorporationOracle is a registered trademark of Oracle CorporationUNIX XOpen OSF1 and Motif are registered trademarks of the Open GroupCitrix ICA Program Neighborhood MetaFrame WinFrame VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems IncHTML XML XHTML and W3C are trademarks or registered trademarks of W3Creg World Wide Web Consortium Massachusetts Institute of TechnologyJava is a registered trademark of Sun Microsystems IncJavaScript is a registered trademark of Sun Microsystems Inc used under license for technology invented and implemented by NetscapeMaxDB is a trademark of MySQL AB SwedenSAP R3 mySAP mySAPcom xApps xApp SAP NetWeaver and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world All other product and service names mentionedare the trademarks of their respective companies Data contained in this document serves informational purposes only National product specifications may vary

The information in this document is proprietary to SAP No part of this document may be reproduced copied or transmitted in any form or for any purposewithout the express prior written permission of SAP AGThis document is a preliminary version and not subject to your license agreement or any other agreement with SAP This document contains only intendedstrategies developments and functionalities of the SAPreg product and is not intended to be binding upon SAP to any particular course of business productstrategy andor development Please note that this document is subject to change and may be changed by SAP at any time without noticeSAP assumes no responsibility for errors or omissions in this document SAP does not warrant the accuracy or completeness of the information text graphicslinks or other items contained within this material This document is provided without a warranty of any kind either express or implied including but not limitedto the implied warranties of merchantability fitness for a particular purpose or non-infringementSAP shall have no liability for damages of any kind including without limitation direct special indirect or consequential damages that may result from the use ofthese materials This limitation shall not apply in cases of intent or gross negligenceThe statutory liability for personal injury and defective products is not affected SAP has no control over the information that you may access through the use ofhot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Webpages

Copyright 2005 SAP AG All Rights Reserved