Example: biology

Making Programs Unicode Enabled - SAP

Making Programs Unicode EnabledAn OverviewTD Core AS&DM I18N Technology (AG)May 15, 2009 SAP 2009 / Page 21. ABAP Language Enhancements2. File Interfaces3. Communication via RFC4. Unicode Enabling ToolsAgenda SAP 2009 / Page 3 Planning: Unicode Enabling of Customer ABAPP rogramsUnicode Enabling must be performed before the Unicode conversion in the Non- Unicode system via transaction UCCHECK (available as of SAP Web AS ).In UCCHECK a clear distinction between character and byte processing in Unicode : Same ABAP source in Unicode and in non- Unicode systemABAP sourceABAP sourceNon-UnicodeSAP R/3 UnicodeSAP R/3 1 character = 2 bytes (UTF-16),(types C, N, D, T, STRING) Unicode kernel Unicode database 1 character = 1 byte (types C, N,D, T, STRING) Non- Unicode ker

Unicode Enabling must be performed before the Unicode conversion in the Non- Unicode system via transaction UCCHECK (available as of SAP Web AS 6.20). In UCCHECK a clear distinction between character and byte processing in Unicode is

Tags:

  Programs, Making, Enabled, Unicode, Making programs unicode enabled

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Making Programs Unicode Enabled - SAP

1 Making Programs Unicode EnabledAn OverviewTD Core AS&DM I18N Technology (AG)May 15, 2009 SAP 2009 / Page 21. ABAP Language Enhancements2. File Interfaces3. Communication via RFC4. Unicode Enabling ToolsAgenda SAP 2009 / Page 3 Planning: Unicode Enabling of Customer ABAPP rogramsUnicode Enabling must be performed before the Unicode conversion in the Non- Unicode system via transaction UCCHECK (available as of SAP Web AS ).In UCCHECK a clear distinction between character and byte processing in Unicode : Same ABAP source in Unicode and in non- Unicode systemABAP sourceABAP sourceNon-UnicodeSAP R/3 UnicodeSAP R/3 1 character = 2 bytes (UTF-16),(types C, N, D, T, STRING) Unicode kernel Unicode database 1 character = 1 byte (types C, N,D, T, STRING) Non- Unicode kernel Non- Unicode database SAP 2009 / Page 4 Representation of Unicode CharactersUTF-16 Unicode Transformation Format, 16 bit encoding Fixed length, 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)

2 Platform dependent byte orderUTF-8 Unicode Transformation Format, 8 bit encoding Variable length, 1 character = bytes Platform independent 7 bit US ASCII compatibleE391B979 3434 79U+3479CE B1B1 0303 B1U+03B1DC3 A4E4 0000 E4U+00E4 6161 0000 61U+0061aUTF-8 UTF-16little endianUTF-16big endianUnicodescalar valueCharacterF0A081BB00DA7 BDCDA00 DC7BU+2007B SAP 2009 / Page 5 Representation of Unicode characters in ABAP Keep existing coding as far as possible Use existing character type for Unicode data Use UTF-16 to keep buffer sizes SAP 2009 / Page 6 Transparent Unicode Enabling of R/3 Character Expansion

3 Model Separate Unicode and non- Unicode versions of R/3 No explicit Unicode data type in ABAP Single ABAP source for Unicode and non- Unicode systems 1 character = 2 bytes (UTF16),(types C, N, D, T, STRING) Unicode kernel Unicode database 1 character = 1 byte(types C, N, D, T, STRING) Non- Unicode kernel Non- Unicode databaseABAP sourceNon-UnicodeR/3 UnicodeR/3 ABAP sourceABAP source SAP 2009 / Page 7 ABAP Unicode Enabling Golden RuleDistinguish character and byte-based data1 Character 1 Byte SAP 2009 / Page 81. ABAP Language Enhancements2.

4 File Interfaces3. Communication via RFC4. Unicode Enabling ToolsAgenda SAP 2009 / Page 9 Program Attribute Unicode checks active SAP 2009 / Page 10 Unicode - Enabled ABAP ProgramsProgram attribute Unicode checks active Required to run on a Unicode system If attribute is set, additional restrictions: apply at compile and at run time apply in Unicode systems and in non- Unicode systems ensure that program will run on non- Unicode and Unicode systems with (almost) identicalbehaviornot allowedokAttribute not set(not Unicodeenabled)okokAttribute set( Unicode Enabled )UnicodesystemNon-Unicodesystem SAP 2009 / Page 11 CONCATENATE cf1 cf2 TO cf1 CS cf2.

5 CONCATENATE xf1 xf2 TO xf3IN BYTE xf1 BYTE-CSxf2.. Unicode Restrictions String ProcessingCharacter Processing String operations are only allowed for character-like operands ABAP types C, N, D, and T, STRING Structures consisting only of characters (C, N, D, T) X and XSTRING are no longer considered character-like typesByte Processing Variants of string operations for byte processing Addition IN BYTE MODE for statements Prefix BYTE- for comparison operations Only operands of type X or XSTRING allowed SAP 2009 / Page 12 Unicode Restrictions Length and DistanceDetermining the Length and Distance Counted in bytes or in characters?

6 Specify!DESCRIBE (BYTE | CHARACTER) MODEDESCRIBE DISTANCE BETWEEN .. AND .. INTO ..IN (BYTE | CHARACTER) write3 USING fld TYPE : fldlen TYPE FIELD fld LENGTH fldlenIN CHARACTER fldlen >= : / fld(3). SAP 2009 / Page 13 Unicode Restrictions Access with Offset orLengthAccess To Structures With Offset/Length Structure must begin with characters Offset/length counted in characters Access only allowed within the character type prefix of a structureASSIGN fld+off(len) TO .. Access must not exceed field boundaries If ASSIGN fails, field-symbol is set to unassigned New.

7 RANGE addition allows the permissible boundariesto be expandedN(6)C(4)X(3)C(5)+off(len) SAP 2009 / Page 14 New ABAP Features Includes with GroupNamesskey = = : = stru(4).srest = stru+4(20).WRITE: Enabled with group namesDATA: BEGIN OF TYPE t_keyas TYPE t_restas : END OF : skey TYPE t_key,srest TYPE : BEGIN OF t_key,k1(2) TYPE x,k2(2) TYPE c,END OF : BEGIN OF t_rest,r1(10) TYPE c,r2(10) TYPE c,END OF k2r1 r2keyrestSymbolic Access to Includes of Structures SAP 2009 / Page 15 New ABAP Features Golden RuleThink in typesThink in semanticsTell the system what you want to do SAP 2009 / Page 16 Unicode Restrictions - MOVEMOVE Between Incompatible Structures Matching data layout ( fragment views ) requiredExampleC(4)C(3)X(3)C(4)IC(6)N(4) X(3)N(4)IP(8)C(3)C(10)X(3)C(4)IP(8)struc 1struc2fragmentscstru = xstru.

8 " Unicode error!DATA:BEGIN OF cstru,first(10) TYPE c,tab(1) TYPE c,last(10) TYPE c,END OF :BEGIN OF xstru,first(10) TYPE c,tab(1) TYPE x VALUE '09',last(10) TYPE c,END OF xstru. SAP 2009 / Page 17 DATA: my_buffer TYPE TYPE = data1TO DATA read_buffer USING buffer TYPE : fld2 TYPE = fld2 FROM DATA ABAP Features Import/Export DataBufferUsing fields of type xstring as data containers Writing data to an xstring Data is stored in a platform-independent format Contents of xstring can be exchanged with any other ( Unicode and non- Unicode )

9 Reading data from an xstring Automatic conversion of data during import SAP 2009 / Page 18 New ABAP Features Dynamic ProgrammingSupportCreating data objects dynamically Creating and accessing data objects on the heapCasting to user-defined types Look at the contents of a field as a value of another type fld must provide sufficient alignment and length for the given typeDATA: dref TYPE REF TO DATA drefTYPE DATA drefTYPE (typename).CREATE DATA drefTYPE c LENGTH DATA drefTYPE STANDARD TABLE OF (typename)ASSIGN dref->* TO <f>.

10 "access data objectFIELD-SYMBOLS: <f> TYPE fld TO <f>CASTING TYPE fld TO <f>CASTING TYPE (typename). SAP 2009 / Page 19 SIMPLESIMPLECLIKECLIKEXSEQUENCEXSEQUENCE CSEQUENCECSEQUENCENUMERICNUMERICIIFFPPXX XSTRINGXSTRINGCCSTRINGSTRINGNNDDTT character-likestructures(C,N,D,T)charact er-likestructures(C,N,D,T)New ABAP Features - Generic TypesNew generic types for parameters and field-symbols Eliminate untyped parameters or field-symbols for improved security and performance SAP 2009 / Page 20 New ABAP Features EnhancementcategorizationIf you are writing software for others you may have the followingProblem Enhancements on structures or tables may affect your coding: Syntax-/runtime errors Changed behavior ( damaged or changed data)Solution Maintaining the enhancement category in the DDIC.


Related search queries