Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

unicode programming

Former Member
0 Kudos

wht is unicode programming and uni code check

4 REPLIES 4

Former Member
0 Kudos

Unicode - an international standard that supports virtually all of the languages and scripts used in the world, ensuring that they function no matter what the language or platform. Future versions of SAP applications will be exclusively in 64-bit and Unicode starting in 2007

The main difference is that one character can be more then one byte now. So weird programs are showing non-aligned lists now. Or interfaces will no more work if the code insist that the starting of some fields always is at the same position.

Casting in a non-unicode envirinment might be ok but can fail in a unicode environment, syntax check does not help you.

You have to test all programs even those untouched if they still do what they are intended to do, listlayout might be disturbed, screen layout might be disturbed, import/export of files is extremly dangerous causi it can happen that no error will occur, but strange data is handled

The Link will be helpful to you.

Very good document:

http://www.doag.org/pub/docs/sig/sap/2004-03/Buhlinger_Maxi_Version.pdf

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d37d1ad9-0b01-0010-ed9f-bc322231...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/589d18d9-0b01-0010-ac8a-8a228520...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f8e316d9-0b01-0010-8e95-829a58c1...

Look at the Below SAP link to know about the Unicode programming

http://help.sap.com/saphelp_nw04/helpdata/en/62/3f2cadb35311d5993800508b6b8b11/content.htm

http://help.sap.com/saphelp_47x200/helpdata/en/62/3f2cadb35311d5993800508b6b8b11/content.htm

http://service.sap.com/unicode

http://service.sap.com/unicode@SAP

http://service.sap.com/i18n

https://www.sdn.sap.com/irj/sdn/collaboration

Check this website.

http://www.unicode.org/

Rewards if useful.......

Minal Nampalliwar

Former Member
0 Kudos

Hi Pavan,

Upto 4.6B SAP systems are non-unicode systems, which will not support multiple code pages. it will support only single code pages.

reward if it helps,

Satish

Former Member
0 Kudos

Hi

<b>

ABAP and Unicode</b>

From Release 6.10, ABAP supports multi-byte coding for characters in Unicode. Prior to Release 6.10, ABAP used only character sets that were based on single-byte codes – such as ASCII and EBCDIC – or double-byte codes, such as SJIS and BIG5.

This switch to Unicode affects all statements where an explicit or implicit assumption is made about the internal length of a character. If you use these statements in a program that is designed to exploit the Unicode capabilities of the runtime environment, they must be checked and changed if necessary. Once a Unicode-enabled program has been changed accordingly, it behaves in the same way in both Unicode and non-Unicode systems. You can develop programs in a non-Unicode system (NUS) and then import them into a Unicode system (US). The following sections describe the conversions that are necessary:

http://help.sap.com/saphelp_erp2004/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

<b>Reward if usefull</b>

mahaboob_pathan
Contributor
0 Kudos

Hi,

Intial screen where you can enter your selection criteria, only field you will prob need to chnage is the max number of

programs field so that it is high enough to return all your potential problems.

If you have not set your max programs field high enough you will see the following screen during execution.

Once the transaction as finished analysing your systenm it will provide you with a report detailing all your objects which do not currently have

the unicode attribute selected. It also details what problems you will have when you check the unicode attribute and try to reactivate the object.

Unicode attribute can be turned on without any modification to the object

Modification(s) to the object will be required before unicode can be switched on

Error in code which is unrelated to unicode conversion

Error code Solution instructions

MESSAGEG@3

Replace variable declaration of type X with appropriate value from method cl_abap_char_utilities

i.e. CONSTANTS: con_tab TYPE x VALUE '09',

con_cret TYPE x VALUE '0D'.

would be replaced with

CONSTANTS: con_tab TYPE c value cl_abap_char_utilities=>HORIZONTAL_TAB,

con_cret TYPE c value cl_abap_char_utilities=>CR_LF.

See here for further Hex code values

UPLO

Upload/ws_upload and download/ws_download are obsolete, since they are not Unicode enabled. Replace

with appropriate methods from cl_gui_frontend_services. Please also note that the data types of the various

parameters will also probably also need changing for the new method calls but the code below demonstrates

how to do this. I_TABLE is the original table and IT_UCTABLE is the converted table.

i.e. Function module ‘WS_DOWNLOAD’

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

FILENAME = p_file

FILETYPE = 'ASC'

MODE = ' '

TABLES

DATA_TAB = i_table

EXCEPTIONS

..

would be replaced with

data: gd_file type string.

types: t_uctable like line of i_table.

data: it_uctable type standard table of t_uctable.

gd_file = p_file.

it_uctable[] = i_table[].

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = gd_file

filetype = 'ASC' " DAT,WK1

Append = ' ' "if mode = A then this would be X

CHANGING

data_tab = it_uctable

EXCEPTIONS

OTHERS = 1.

Function module ‘DOWNLOAD’

CALL FUNCTION 'DOWNLOAD'

EXPORTING

filename = p_file

filetype = 'WK1'

TABLES

data_tab = i_table.

..

would be replaced with

data: gd_file type string.

DATA: ld_filename TYPE string,

ld_path TYPE string,

ld_fullpath TYPE string,

ld_result TYPE i.

types: t_uctable like line of i_table.

data: it_uctable type standard table of t_uctable.

gd_file = p_file.

shift gd_file RIGHT DELETING TRAILING '\'.

shift gd_file RIGHT DELETING TRAILING '/'.

shift gd_file left DELETING LEADING space.

CALL METHOD cl_gui_frontend_services=>file_save_dialog

EXPORTING

DEFAULT_EXTENSION = 'WK1'

default_file_name = gd_file

INITIAL_DIRECTORY = gd_file

CHANGING

filename = ld_filename

path = ld_path

fullpath = ld_fullpath

user_action = ld_result.

check ld_result eq 0.

gd_file = ld_fullpath.

gd_file = p_file.

it_uctable[] = i_table[].

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = gd_file

filetype = 'ASC' " DAT,WK1

Append = ' ' "if mode = A then this would be X

CHANGING

data_tab = it_uctable

EXCEPTIONS

OTHERS = 1.

Or in circumstances where you need to add field texts to the first line of the file you could use the

GUI_DOWNLOAD function module:

DATA: BEGIN OF fields_tab OCCURS 0,

f1(50),

END OF fields_tab.

fields_tab-f1 = 'field1 text'.

APPEND fields_tab.

fields_tab-f1 = 'field2 text'.

APPEND fields_tab.

fields_tab-f1 = 'field3 text'.

APPEND fields_tab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = i_filename

filetype = 'DAT'

IMPORTING

filelength = filelen

TABLES

data_tab = itab

fieldnames = fields_tab

EXCEPTIONS

.....

-


Note: ‘ws_upload’ and ‘upload’ would be the same as above but would use the

cl_gui_frontend_services=>gui_upload method call instead:

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = gd_file

filetype = 'ASC' " DAT,WK1

Append = ' '

CHANGING

data_tab = it_uctable

EXCEPTIONS

OTHERS = 1.

OPEN 004

Add ‘ENCODING’ addition to statement

i.e. OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE.

would be replaced with

OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE ENCODING NON-UNICODE.

OPEN 002

IN..Mode is expected within open dataset command.

i.e. OPEN DATASET wfilepath FOR OUTPUT.

would be replaced with

OPEN DATASET wfilepath FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.

Or OPEN DATASET wfilepath FOR OUTPUT IN BINARY MODE.

OPEN 001

FOR INPUT, FOR OUTPUT, FOR APPENDING or FOR UPDATE expected!

i.e. OPEN DATASET wfilepath FOR OUTPUT.

would be replaced with

OPEN FOR OUTPUT DATASET wfilepath FOR OUTPUT IN TEXT MODE.

DESCIBE002

THE DESCRIBE LENGTH can only be used with the IN BYTE or IN CHARACTER MODE

i.e. describe field e_text length line_length.

would be replaced with

describe field e_text length line_length IN CHARACTER MODE.

ASSIGN 019

The statement ‘ASSIGN PATH+PATHLENGTH TO

.’ Returns the following error message:

"You cannot use ASSIGN f+offset. Always use an explicit length (or '*')".

i.e. ASSIGN PATH+PATHLENGTH TO

.

would be replaced with

ASSIGN PATH+PATHLENGTH(2) TO

. “replace 2 with the length of the field

MESSAGEG!2

Itab/structure and “ “ are not mutually convertible in a Unicode program

i.e. G_SHOW_LIST = SPACE.

would be replaced with

Clear: G_SHOW_LIST.

Or G_SHOW_LIST-field1 = space.

G_SHOW_LIST-field2 = space.

…etc

MESSAGEG!3

var and var are not comparable in a Unicode program

Example Data: VAR like tabix.

was replaced with

Data: VAR type sy-tabix.