iShare
The IntelliCorp Community Site
Ready for Unicode

LiveCompare 2.1 features a new upgrade template - U.10 - Unicode Syntax Check - that analyzes custom code for Unicode compatibility.  The template is primarily aimed at SAP customers that are running pre-620 kernels (R/3 Enterprise) such as 4.6 where SAP's own UCHECK functionality doesn't exist.  To use UCHECK you'd need to bring up the target system and copy across all your customizations.  Using LiveCompare there's no need to mess about copying custom code over.  Just point the template at your as-is and to-be systems and it will magically invoke UCHECK for you.

Using this sample program (thanks Pete):

REPORT Z_UNICODE_ERRORS .
* Test program to show the errors that can be picked up with Unicode
* checks.


*1. Calling a function module with a parameter that is not defined in
* the function.

DATA: FIELDTAB#LIKE TABLE OF#DFIES.

CALL FUNCTION 'GET_FIELDTAB'
TABLES
FIELDTAB = FIELDTAB
THISISWRONG = FIELDTAB
EXCEPTIONS
INTERNAL_ERROR = 1
NO_TEXTS_FOUND = 2
TABLE_HAS_NO_FIELDS = 3
TABLE_NOT_ACTIV = 4
OTHERS = 5.

*2.#Non-alphanumeric values found in variables or structures of
*statements like DESCRIBE, CONCATENATE, WRITE, TRANSFER etc.. (or any
*other statements that defined only for character-type objects) at
*runtime.

DATA: FLDLEN TYPE I,
FLD TYPE C,
DIST TYPE I.

DESCRIBE FIELD FLD LENGTH FLDLEN. " unicode IN BYTE/CHARACTER MODE.
DESCRIBE DISTANCE BETWEEN FLD AND FLD
INTO DIST. " unicode IN BYTE/CHARACTER MODE.

DATA: C1(1) TYPE C,
C2(1) TYPE C,
C3(100) TYPE C,
XSTR TYPE XSTRING,
X(1) TYPE X.
CONCATENATE C1 XSTR C2 INTO C3.
CONCATENATE C1 X C2 INTO C3.

DATA:BEGIN OF CSTRU,
FIRST(10) TYPE C,
TAB(1) TYPE C,
LAST(10) TYPE C,
END OF CSTRU.

DATA:BEGIN OF XSTRU,
FIRST(10) TYPE C,
TAB(1) TYPE X VALUE '09',
LAST(10) TYPE C,
END OF XSTRU.

MOVE XSTRU TO CSTRU.
CSTRU = XSTRU.

*3.#Reading/writing data from/to files that were not opened in
*correct format (ie. Unicode vs non-Unicode encoding)

DATA: DSN(20) VALUE '/usr/test.dat',
REC(80).
OPEN DATASET DSN IN TEXT MODE."ENCODING (DEFAULT | UTF-8 | NON-UNICODE).
IF SY-SUBRC = 0.
DO.
READ DATASET DSN INTO REC.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
WRITE / REC.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET DSN.

*4. Access To Structures With Offset/Length. Structure must begin
* with characters in unicode.

DATA:BEGIN OF STRU2,
FIRST TYPE I,
TAB(1) TYPE C,
LAST(10) TYPE C,
END OF STRU2,

RESULT2(100) TYPE C.

MOVE STRU2+2(5) TO RESULT2.

on a 4.6c system leads to the following Unicode compatibility errors when analyzed in the context of an ERP 6 system:

 

 

Code LineUnicode Error
DESCRIBE FIELD FLD LENGTH FLDLEN. +ACI- unicode IN BYTE/CHARACTER MODE. In Unicode, DESCRIBE LENGTH can only be used with the IN BYTE MODE or IN CHARACTER MODE addition.
DESCRIBE DISTANCE BETWEEN FLD AND FLD In Unicode, DESCRIBE DISTANCE can only be used with the IN BYTE MODE or IN CHARACTER MODE addition.
CONCATENATE C1 XSTR C2 INTO C3. +ACI-XSTR+ACI- must be a character-like data object (data type C, N, D, T, or STRING) .
CONCATENATE C1 X C2 INTO C3. +ACI-X+ACI- must be a character-like data object (data type C, N, D, T, or STRING) .
MOVE XSTRU TO CSTRU. +ACI-CSTRU+ACI- and +ACI-XSTRU+ACI- are not mutually convertible. In Unicode programs, +ACI-CSTRU+ACI- must have the same...
CSTRU +AD0- XSTRU. +ACI-CSTRU+ACI- and +ACI-XSTRU+ACI- are not mutually convertible. In Unicode programs, +ACI-CSTRU+ACI- must have the same...
OPEN DATASET DSN IN TEXT MODE.+ACI-ENCODING (DEFAULT +AHw- UTF-8 +AHw- NON-UNICODE). One of the additions +ACI-FOR INPUT+ACI-, +ACI-FOR OUTPUT+ACI-, +ACI-FOR APPENDING+ACI-, or +ACI-FOR UPDATE+ACI- was expected.
MOVE STRU2+-2(5) TO RESULT2. The structure +ACI-STRU2+-2(5)+ACI- does not start with a character-type field. In Unicode programs in suc...

 

Yes, these are the very same error messages I'd get if I copied the program to a Unicode SAP system and ran UCHECK.

The template actually generates more information but this should illustrate the idea.  Like all the upgrade templates, the output is an Access database that can be easily shared by team members.

So if you're upgrading from 4.6 to ERP 6 and want to get ready for Unicode, run U.10 - Unicode Syntax Check and discover how much recoding you have ahead of you.


Posted 11-25-2008 10:56 AM by Chris Trueman
Filed under: