sapdev logo background
sapdev logo sapdev logo
Comments

Various Unicode convertion errors report via UCCHECK




Solution instructions to the following unicode conversion error message i.e. MESSAGE@3, UPLO, OPEN 004 etc

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.


MESSAGEG-H

MESSAGEG@E

MESSAGEG@1

Return toUnicode home




comments powered by Disqus