0% found this document useful (0 votes)
63 views

Common Errors Unicode New1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Common Errors Unicode New1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 40

Common Unicode

Errors
(SAP Version ECC 6.0)

Created by : Dheeraj Madan

Common Unicode Errors Page 1


Guidelines to use the Document

1. In the Examples provided, three types of color coding are used.

o The Normal Black Ones are the codes that were existing in the Program/
Object.

o The Blue Ones with an asterisk (*) in front are the lines that were
commented out in the existing code to make it Unicode Compliant.

o The Red Ones are the codes which were inserted into the object/ program
to compensate the functionalities provided by the lines that were
commented out during Unicode compliant check.

The Black, Blue and Red lines are actual piece of ABAP code.

2. For ease of understanding, in the document,


o 4.6C refers to Non Unicode environment
o ECC 6.0 refers to Unicode Complaint environment

3. “Error” mentioned henceforth are the actual errors that were generated after
executing UCHECK transaction in UNICODE environment.

4. The errors having similar solution/ resolutions have been clubbed under same
“TYPE” for better understanding.

Common Unicode Errors Page 2


Transaction Code to Perform Unicode Compliance check:

TCode to perform Unicode Check : UCCHECK

How to Set the Unicode Flag Active

After resolving all the errors under the Unicode Check, we can set the Unicode Flag.
This can be done in either of the two ways.

1. From the Transaction UCCHECK itself, by selecting the success message of the
object and then clicking on the Set Unicode Attribute button .

2. Go directly to the object, Go To -> Attributes -> Change Display -> Check the
Unicode Flag Active -> Save -> Activate.

Common Unicode Errors Page 3


Some of the Common Errors in UCCHECK and their resolution.

Case - 1:

Error : Upload/Ws_Upload and Download/Ws_Download are obsolete, since they


are not Unicode-enabled; use the class cl_gui_frontend_services

Cause : From Version ECC6.0 (Unicode complaint environment), the Function


Modules UPLOAD / WS_UPLOAD / DOWNLOAD / WS_DOWNLOAD has become
obsolete. In replacement of these Function Modules, we have GUI_UPLOAD /
GUI_DOWNLOAD.

Solution: All the UPLOAD / WS_UPLOAD function modules need to be replaced with
GUI_UPLOAD FM and all the DOWNLOAD / WS_DOWNLOAD with the
GUI_DOWNLOAD function modules.

For replacing WS_UPLOAD :

*{ REPLACE EMPK900094
1
*\ call function 'WS_UPLOAD'
*\ exporting
*\ filename = p_filel
*\ filetype = 'DAT' "'ASC' "'DAT'
*\ tables
*\ data_tab = record
*\ exceptions
*\ conversion_error = 1
*\ file_open_error = 2
*\ file_read_error = 3
*\ invalid_type = 4
*\ no_batch = 5
*\ unknown_error = 6
*\ invalid_table_width = 7
*\ gui_refuse_filetransfer = 8
*\ customer_error = 9
*\ others = 10.

** Begin of Changes - 46C To ECC6 - IN9KHOSLA

DATA : L_P_FILEL TYPE STRING.


L_P_FILEL = P_FILEL.

CALL FUNCTION 'GUI_UPLOAD'

Common Unicode Errors Page 4


EXPORTING
FILENAME = L_P_FILEL
FILETYPE = 'ASC'
TABLES
DATA_TAB = RECORD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.

IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

** End of Changes - 46C To ECC6 - IN9KHOSLA


*} REPLACE

Note - 1 : The parameter FILENAME in GUI_UPLOAD is of type STRING for version


ECC6.0. In 4.6C version (Non Unicode complaint environment), for the above code,
export parameter filename in UPLOAD / WS_UPLOAD was of data type “Character”.
This need to be taken care of otherwise if an Extended Syntax Check is performed using
the transaction SLIN, there would bet a Call Function Interface Error because of this.
So to avoid that, one needs to declare a variable L_P_FILEL of type STRING and
assigning that to the Parameter FILENAME. Also it’s better to have file type ‘ASC’.

For replacing WS_DOWNLOAD:

Common Unicode Errors Page 5


*{ REPLACE RE2K900049
1
*\ CALL FUNCTION 'WS_DOWNLOAD'
*\ EXPORTING
*\ FILENAME = W_FILENAME
*\ FILETYPE = 'ASC'
*\ TABLES
*\ DATA_TAB = TAB_PC2
*\ EXCEPTIONS
*\ FILE_OPEN_ERROR = 1
*\ FILE_WRITE_ERROR = 2
*\ INVALID_FILESIZE = 3
*\ INVALID_TYPE = 4
*\ NO_BATCH = 5
*\ UNKNOWN_ERROR = 6
*\ INVALID_TABLE_WIDTH = 7
*\ GUI_REFUSE_FILETRANSFER = 8
*\ CUSTOMER_ERROR = 9
*\ OTHERS = 10.
*\
** Begin of Changes - 46C To ECC6 - IN9KHOSLA
DATA : L_W_FILENAME TYPE STRING.
L_W_FILENAME = W_FILENAME.

CALL FUNCTION 'GUI_DOWNLOAD'


EXPORTING
FILENAME = L_W_FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = TAB_PC2
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15

Common Unicode Errors Page 6


DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** End of Changes - 46C To ECC6 - IN9KHOSLA

For replacing UPLOAD :

Common Unicode Errors Page 7


PARAMETERS: I_NFILE LIKE RLGRAP-FILENAME DEFAULT
'c:\fi\docgen.prn'.

Note : Please make sure that default location is given if its not then dont use default
filename parameter in your Function module.

*{ REPLACE RE2K900049
1
*\ CALL FUNCTION 'UPLOAD'
*\ EXPORTING
*\ FILENAME = I_NFILE "NOME FILE
*\ FILETYPE = 'ASC'
*\ TABLES
*\ DATA_TAB = FILIN
*\ EXCEPTIONS
*\ CONVERSION_ERROR = 1
*\ INVALID_TABLE_WIDTH = 2
*\ INVALID_TYPE = 3
*\ NO_BATCH = 4
*\ UNKNOWN_ERROR = 5
*\ OTHERS = 6.
*\

So we will be using the method ` GUI_UPLOAD` of the class


`CL_GUI_FRONTEND_SERVICES`. Now in 4.6, while using FM UPLOAD, a pop-up
used to appear, prompting you to get/locate the path of the file. To get the same
functionality in GUI_UPLOAD use code as below-

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


data: ft type filetable,
rc type i,
l_i_nfile type string,
l_i_nfile_temp type string.

data: l_ft type line of filetable.


l_i_nfile_temp = i_nfile.
******* Begin Dheeraj if Import parameters not have cancel
option
Data : l_action type i. **dheeraj
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'File open'
DEFAULT_FILENAME = l_i_nfile_temp
CHANGING

Common Unicode Errors Page 8


FILE_TABLE = ft
RC = rc
user_action = l_action
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.

if ( l_action <> CL_GUI_FRONTEND_SERVICES=>action_cancel ).

******* end Dheeraj if Import parameters not have cancel


option

One more exam[ple


**Begin of Changes UPADJ Dheeraj 12-01-2010
* call function 'UPLOAD'
* EXPORTING
** CODEPAGE =''
* FILENAME = p_file
** FILETYPE =''
** ITEM =''
** FILEMASK_MASK =''
** FILEMASK_TEXT =''
** FILETYPE_NO_CHANGE =''
** FILEMASK_ALL =''
** FILETYPE_NO_SHOW =''
** LINE_EXIT =''
** USER_FORM =''
** USER_PROG =''
** SILENT = 'S'
** IMPORTING
** FILESIZE =
** CANCEL =
** ACT_FILENAME =
** ACT_FILETYPE =
* tables
* data_tab = tf
** EXCEPTIONS
** CONVERSION_ERROR =1
** INVALID_TABLE_WIDTH =2
** INVALID_TYPE =3
** NO_BATCH =4
** UNKNOWN_ERROR =5
** GUI_REFUSE_FILETRANSFER =6
** OTHERS =7
* .
* if sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* endif.

Common Unicode Errors Page 9


data: ft type filetable,
rc type i,
l_p_file type string,
l_p_file_temp type string,
l_action type i.
data: l_ft type line of filetable.

l_p_file_temp = p_file.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG


EXPORTING
WINDOW_TITLE = 'File open'
DEFAULT_FILENAME = l_p_file_temp
CHANGING
FILE_TABLE = ft
RC = rc
user_action = l_action
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.

if ( l_action <> CL_GUI_FRONTEND_SERVICES=>action_cancel ).

read table ft into l_ft index 1.

l_p_file = l_ft-filename.

CALL FUNCTION 'GUI_UPLOAD'


EXPORTING
FILENAME = l_p_file
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR =''
* HEADER_LENGTH =0
* READ_BY_LINE = 'X'
* DAT_MODE =''
* CODEPAGE =''
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM =''
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK =''
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = tf
* EXCEPTIONS
* FILE_OPEN_ERROR =1
* FILE_READ_ERROR =2
* NO_BATCH =3
* GUI_REFUSE_FILETRANSFER =4
* INVALID_TYPE =5
* NO_AUTHORITY =6
* UNKNOWN_ERROR =7
* BAD_DATA_FORMAT =8
* HEADER_NOT_ALLOWED =9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11

Common Unicode Errors Page 10


* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
**End of Changes UPADJ Dheeraj 12-01-2010

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG


EXPORTING
WINDOW_TITLE = 'File open'
DEFAULT_FILENAME = l_i_nfile_temp
CHANGING
FILE_TABLE = ft
RC = rc
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.

IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

read table ft into l_ft index 1.

l_i_nfile = l_ft-filename.

CALL FUNCTION 'GUI_UPLOAD'


EXPORTING
FILENAME = l_i_nfile
FILETYPE = 'ASC'
TABLES
DATA_TAB = FILIN
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6

Common Unicode Errors Page 11


UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.

IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Endif. “for i_action
** End of Changes - 46C To ECC6 - IN9KHOSLA

**UPLOAD
******* Dheeraj if Import parameters have cancel option & we use
action variable
data: ft type filetable,
rc type i,
l_i_nfile type string,
l_i_nfile_temp type string,
l_action type i.

data: l_ft type line of filetable.


l_i_nfile_temp = 'i:\sapr3\erp-pm'.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG


EXPORTING
WINDOW_TITLE = 'File open'
DEFAULT_FILENAME = l_i_nfile_temp
CHANGING
FILE_TABLE = ft
RC = rc
user_action = l_action
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.

Clear W_CANCEL.

Common Unicode Errors Page 12


if ( l_action = CL_GUI_FRONTEND_SERVICES=>action_cancel ).
W_CANCEL = 'X'.
else.

read table ft into l_ft index 1.

l_i_nfile = l_ft-filename.

CALL FUNCTION 'GUI_UPLOAD'


EXPORTING
FILENAME = l_i_nfile
FILETYPE = 'DAT'
importing
filelength = w_filesize
TABLES
DATA_TAB = WT_REC
EXCEPTIONS
BAD_DATA_FORMAT = 1
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
OTHERS = 6.

w_filename = l_i_nfile.
w_filetype = 'DAT'.
endif.

For replacing DOWNLOAD :

DOWNLOAD is obsolete function module for storing SAP data in a file in the file
system of the presentation server.
EXAMPLE :

PARAMETERS: PC_FILE LIKE RLGRAP-FILENAME DEFAULT


'c:\test.txt' modif id LOC.

* CALL FUNCTION 'DOWNLOAD'


* EXPORTING
* FILENAME = PC_FILE
* FILETYPE = 'DAT'
* IMPORTING

Common Unicode Errors Page 13


* FILESIZE = W_FSIZE
* ACT_FILENAME = W_FNAME
* ACT_FILETYPE = W_FTYPE
* TABLES
* DATA_TAB = TAB
* EXCEPTIONS
* CONVERSION_ERROR = 1
* INVALID_TABLE_WIDTH = 2
* INVALID_TYPE = 3
* NO_BATCH = 4
* UNKNOWN_ERROR = 5
* OTHERS = 6.

So we will be using the method `GUI_DOWNLOAD` of the class


`CL_GUI_FRONTEND_SERVICES`. Now in 4.6, while using FM DOWNLOAD, a
pop-up used to appear, prompting you to to put the path to save the file. To get the same
functionality in GUI_DOWNLOAD use code as below-

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


data: l_filename type string,
l_path type string,
l_fullpath type string,
l_filename_temp type string,
i_action type i.

l_filename_temp = PC_FILE.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG


EXPORTING
WINDOW_TITLE = 'File save'
DEFAULT_FILE_NAME = l_filename_temp
CHANGING
FILENAME = l_filename
PATH = l_path
FULLPATH = l_fullpath
USER_ACTION = i_action
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.

IF i_Action <> CL_GUI_FRONTEND_SERVICES=>action_cancel.

Common Unicode Errors Page 14


CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = l_fullpath
FILETYPE = 'ASC'
TABLES
DATA_TAB = tab
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** End of Changes - 46C To ECC6 - IN9KHOSLA

Case - 2 :

Error : WG_CRLF must be a character-like data object (data type C, N, D, T,or


STRING) STRING).

Cause: Here WG_CRLF may be a variable or an internal table which contains variables
which are of type X. Type X is used to represent hexadecimal values. Each
Hexadecimal value can hold two characters (8 bits). These Hexadecimal values may also
represent the codes for performing some actions like Horizontal Tab, Line Feed, etc. Till

Common Unicode Errors Page 15


Version 4.6C (Non Unicode complaint environment), there was no problem if we try to
assign a type C to type X and vice versa. But from Version ECC6.0, it’s not possible.

Solution: So we need to change all the X type variables to the C type Variables with
their values unchanged. This can be tackled by declaring a variable as Type C, and then
use the method UCCP('XXXX') of the Class CL_ABAP_CONV_IN_CE where XXXX
represents the 8-bit hexadecimal value represented as 16 bits. Before this we need to load
the definition of the Class CL_ABAP_CONV_IN_CE.

Example:
is not possible. CLASS CL_ABAP_CHAR_UTILITIES DEFINITION
LOAD statement

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


CLASS: CL_ABAP_CONV_IN_CE DEFINITION LOAD.
** End of Changes - 46C To ECC6 - IN9KHOSLA

*\DATA: BEGIN OF wg_crlf,


*\ crlf(2) TYPE x VALUE '0D0A',
*\ END OF wg_crlf,

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


DATA: BEGIN OF wg_crlf,
crlf(2) TYPE c,
END OF wg_crlf,
** End of Changes - 46C To ECC6 - IN9KHOSLA

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


wg_crlf-crlf = CL_ABAP_CONV_IN_CE=>UCCP('0D0A').
** End of Changes - 46C To ECC6 - IN9KHOSLA

Note - 1: There are some meths of class CL_ABAP_CHAR_UTILITIES which are used
to remove Errors related to Hexadecimal variables :

Following methods of class CL_ABAP_CHAR_UTILITIES are used for different


values of variables :

cl_abap_char_utilities=>horizontal_tab --- 09
cl_abap_char_utilities=>CR_LF --- 0D0A
cl_abap_char_utilities=>VERTICAL_TAB --- 0B
cl_abap_char_utilities=>NEWLINE --- 0A
cl_abap_char_utilities=>FORM_FEED --- 0C
cl_abap_char_utilities=>BACKSPACE --- 08

Common Unicode Errors Page 16


Examples :

* data : w_tab type x value '09'.

* DATA: HEX_LINEFEED TYPE X VALUE '0A'.


* DATA: LINEFEED TYPPE X VALUE ‘ODOA’.

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


data : w_tab type C VALUE
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

DATA: HEX_LINEFEED TYPE C VALUE


cl_abap_char_utilities=>NEWLINE

DATA: LINEFEED TYPPE C VALUE cl_abap_char_utilities=>CR_LF

** End of Changes - 46C To ECC6 - IN9KHOSLA

Note – 2: For e.g, the variable of type X has length more than one. Then an internal
table must be created for the variable.

Example :

CLASS: CL_ABAP_CONV_IN_CE DEFINITION LOAD.


* DATA : LF(2) TYPE X VALUE 'F5CD'.
DATA : BEGIN OF LF,
A1 TYPE C,
A2 TYPE C,
END OF LF.
START-OF-SELECTION.
LF-A1 = CL_ABAP_CONV_IN_CE=>UCCP('00F5').
LF-A2 = CL_ABAP_CONV_IN_CE=>UCCP('00CD').

Case - 3:

Error : In Unicode, DESCRIBE LENGTH can only be used with the IN BYTE
MODE or IN CHARACTER MODE addition.

Cause: In some cases, the syntax rules that apply to Unicode Programs are different than
those for non-Unicode programs For example, if one uses the addition LENGTH, one
must also use one of the two additions IN CHARACTER MODE or IN BYTE MODE
in Unicode systems.

Solution: Specify the mode depending upon the field types.

Common Unicode Errors Page 17


... IN CHARACTER MODE

This addition can only be used for character-type fields and in combination with the
addition
LENGTH. The length of the field f is determined in characters.

... IN BYTE MODE

This addition can only be used in combination with the addition LENGTH. The
length of the
field f is determined in bytes.

Example:

DATA: FLD(8),
LEN TYPE I,
* DESCRIBE FIELD FLD LENGTH LEN.
DESCRIBE FIELD FLD LENGTH LEN IN CHARACTER MODE.

CASE-4

Error: Could not specify the access range automatically. This means that you need a
RANGE addition.

Cause: Loops with “VARY” or “VARYING” can cause problems in Unicode


environment because, on the one hand, you cannot be sure that you are accessing memory
contents with the correct type and on the other hand, memory could be inadvertently
overwritten.

DO … VARYING f FROM f1 NEXT f2 [RANGE f3].


WHILE … VARY f FROM f1 NEXT f2 [RANGE f3].

With these statements, the fields f, f1 and f2 must be type-compatible with one another.

To avoid overwriting memory contents, a RANGE for valid accesses is implicitly or


explicitly implemented for these statements.

Solution:

If the RANGE f3 addition is specified, a syntax or runtime error is triggered, should f1 or


f2 not be included in f3. For f3, only structures and elementary fields of the types C, N,
or X are permitted.

If the RANGE addition is not specified, it is implicitly defined with FROM f1 NEXT f2
as follows:

Common Unicode Errors Page 18


 If the syntax check recognizes that both f1 and f2 are components of the same
structure, the valid RANGE area is defined from the smallest structure containing
f1 and f2.
 There is a syntax error if the syntax check recognizes that f1 and f2 are not part of
the same structure.
 A valid range must be defined explicitly using RANGE if the syntax check does
no recognize that f1 and f2are not together.

If a deep structure is defined as a RANGE addition, the system checks for every loop
pass that there are no field references, object references, tables, or strings within the
accessed range.

Example:

* DO 10 TIMES VARYING B FROM A+9(1) NEXT A+8(1).


DO 10 TIMES VARYING B FROM A+9(1) NEXT A+8(1) RANGE A+0(1).

Alternative method :

PARAMETERS: P$_TXT01 LIKE SOLISTI1-LINE MODIF ID GRI, "objtxt.


P$_TXT02 LIKE SOLISTI1-LINE MODIF ID GRI.
DATA: W$_TXT00 LIKE SOLISTI1-LINE. "replaces parameter

* DO 3 TIMES VARYING W$_TXT00 FROM P$_TXT01 NEXT P$_TXT02.

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


DATA: BEGIN OF WA_SOLISTI1,
P$_TXT03 TYPE SOLISTI1-LINE,
P$_TXT04 TYPE SOLISTI1-LINE,
END OF WA_SOLISTI1.

WA_SOLISTI1-P$_TXT03 = P$_TXT01.
WA_SOLISTI1-P$_TXT04 = P$_TXT02.

DO 3 TIMES VARYING W$_TXT00 FROM WA_SOLISTI1-P$_TXT03 NEXT


WA_SOLISTI1-P$_TXT04 range WA_SOLISTI1.
** End of Changes - 46C To ECC6 - IN9KHOSLA

Case - 5:

Type - I

Common Unicode Errors Page 19


Error: You cannot use an offset without a length declaration for parameter
“HEAD+2”.

Cause: Usually, while passing parameters, we need to pass the variable as a whole or at
least its position with length must be specified. Till Version 4.6C (Non Unicode
complaint environment), there was no need to specify the length, it didn’t throw any error
but used to take till the full length of the variable. But from Version ECC 6 .0 , it throws
an error.

Solution: For any parameter, if we need to specify the position, it should always be
accompanied by its length.

Example:

DATA:HEAD(100).
* PERFORM APPEND_XFEBRE USING HEAD+2.
PERFORM APPEND_XFEBRE USING HEAD+2(98).

-----------------------------------------------------------------------

Type - II

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

Cause: In Unicode environment, it needs the exact length. We can’t say starting from
2nd position. Till Version 4.6C, it will take the entire variable starting from 2 nd position.
But in Unicode Environment, it is not possible.

Solution: Specify the length or put a *.

Example:

* ASSIGN STXT_LOC+1 TO <B>.


ASSIGN STXT_LOC+1(*) TO <B>.

Case - 6:

Type - I

Error : OBJCONT and "OUT_REC" are not mutually convertible. In Unicode


programs,"OBJCONT" must have the same structure layout as "OUT_REC",
independent of the length of a Unicode character.

Common Unicode Errors Page 20


Cause : In Non Unicode complaint environment, we can assign contents of one variable
to another even if the data type are not the same. But in Unicode complaint environment,
it’s not possible.

Solution: Both the data types first need to be compatible and then can be used to assign
the contents.

Example : Here OBJCONT is a string of length 255, whereas OUT_REC is an internal


table. So we need to specify from which position to position of the String, the fields of
the OUTREC should be assigned.

In the below ABAP code, SOLISTI1 is a table with a single field. - Line char (16)

DATA: OBJCONT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF OUT_REC OCCURS 50, "output record for PRAG


DTYPE(3) VALUE 'A10', "Transaction type
GRPCO(5) VALUE 'CH087', "Group Company Code (CSO)
RECNR(6) TYPE N, "Line- or Record counter
XSTRING(2) TYPE X VALUE '0D0A', "line feed
END OF OUT_REC.

* OBJCONT = OUT_REC.
OBJCONT+0(3) = OUT_REC-DTYPE.
OBJCONT+3(5) = OUT_REC-GRPCO.
OBJCONT+8(6) = OUT_REC-RECNR.
OBJCONT+14(2) = OUT_REC-XSTRING.

Note: If the error is in reversed order, (i.e) OUT_REC and OBJCONT are not mutually
convertible. In Unicode programs, "OBJCONT" must have the same structure layout
as "OUT_REC", independent of the length of a Unicode character. , then we have to
follow the same procedure in reversed order.

* OUT_REC = OBJCONT.
OUT_REC-DTYPE = OBJCONT+0(3).
OUT_REC-GRPCO = OBJCONT+3(5).
OUT_REC-RECNR = OBJCONT+8(6).
OUT_REC-XSTRING = OBJCONT+14(2).

-----------------------------------------------------------

Type - II

Error: REC and "T" are not mutually convertible. In Unicode programs, "REC"
must have the same structure layout as "T", independent of the length of a Unicode
character.

Common Unicode Errors Page 21


Cause: Here, although REC and T are internal tables and have the same fields, T is
having one extra field FAKTOR. Till Version 4.6C, though there was no need to
mention “move-corresponding”, it moved the fields correspondingly. But from Version
ECC6.0 we need to mention it explicitly for Unicode compliance.

Solution: Specify move-corresponding between the fields.

Example:

DATA: BEGIN OF REC,


RECTYPE(1) TYPE C,
BELNR LIKE BSID-BELNR,
BLART LIKE BSID-BLART,
END OF REC.

DATA: BEGIN OF T OCCURS 1000,


RECTYPE(1) TYPE C,
BELNR LIKE BSID-BELNR,
BLART LIKE BSID-BLART,
FAKTOR TYPE P,
END OF T.

* REC = T.
** Begin of Changes - 46C To ECC6 - IN9KHOSLA
MOVE-CORRESPONDING T TO REC.
** End of Changes - 46C To ECC6 - IN9KHOSLA

Type - III

Error : ""DTABC"" and ""' '"" are not mutually convertible in a Unicode program.

Solution : Clear DTABC

*\ dtabc = space. "clear all entries

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


clear dtabc . "clear all entries
** End of Changes - 46C To ECC6 - IN9KHOSLA

Common Unicode Errors Page 22


Case -7:

Type - I

Error: The sum of the offset and length (=1016) exceeds the length of the start
(=1000) of the structure. - not allowed in Unicode programs.

Cause: Till Version 4.6C, even if we don’t specify the length, the system wont throw
any error but will take to the full length of the variable. But from Version ECC6.0, it is
not possible. We need to mention the length explicitly.

Solution: We are supposed to specify the length of the variables without fail for Unicode
compliance.

Example:

* record_tab = ufkt-zuser_id.
* record_tab+10 = ufkt-fktc.
* record_tab+11 = ufkt-zname.

record_tab = ufkt-zuser_id.
record_tab+10(1) = ufkt-fktc.
record_tab+11(50) = ufkt-zname.

----------------------------------------------------------------------------------------------------

Type - II

Error: "BHDGI-T1" and "BHDGI-HF" are type-incompatible.

Cause: The length is not specified.

Solution: So it should be specified to make the code a Unicode Compliant one.

Example:

DATA: bhdgi-hf(1) TYPE c,


bhdgi-t1(70) TYPE c,

* DO VARYING bhdgi-hf FROM bhdgi-t1+0 NEXT bhdgi-t1+1.


DO VARYING bhdgi-hf FROM bhdgi-t1+0(1)NEXT bhdgi-t1+1(1).

Common Unicode Errors Page 23


Case - 8:

Error : In "TEXT MODE" the "ENCODING" addition must be specified.

Cause: Till Version 4.6C, when we open a Dataset it is not necessary to specify the
encoding format. In Non-Unicode systems, this is not mandatory. But from Version ECC
6.0, it has been made mandatory.

Solution: After opening the dataset, specify the encoding format. There are three types
of Encoding format.

on ENCODING (DEFAULT|UTF-8|NON-UNICODE)

This addition specifies the character representation in the file:

DEFAULT
Corresponds to UTF-8 in Unicode systems and to NON-UNICODE in non-
Unicode systems.
UTF-8
Characters are represented in the file in the format UTF-8.
NON-UNICODE
Characters are represented in the file in the code page defined by the text
environment current at the time a READ or TRANSFER command is executed

Example:

*OPEN DATASET FILENAME FOR INPUT IN TEXT MODE MESSAGE MSG.


OPEN DATASET FILENAME FOR INPUT IN TEXT MODE ENCODING NON-UNICODE
MESSAGE MSG.

Case - 9:

Error: IN... MODE was expected.

Cause: In programs without active Unicode check, the file usually opens for reading in binary
mode, if one does not use any additions for OPEN DATASET. But for those Unicode Enabled
Programs, it is not possible and it requires the mode to be specified.

Solution: In programs with active Unicode check, one must specify the access type
(such as ... FOR INPUT, ... FOR OUTPUT, and so on) and the mode (such as ... IN
TEXT MODE, ... IN BINARY MODE, and so on). If the file is opened using ... IN

Common Unicode Errors Page 24


TEXT MODE, you must still use the addition ... ENCODING. If the Unicode check is
enabled, it is possible to use file names containing blanks.

Example:

*OPEN DATASET FILENAME FOR INPUT.


OPEN DATASET FILENAME FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.

Case - 10:

Error: One of the additions "FOR INPUT", "FOR OUTPUT", "FOR


APPENDING" or "FOR UPDATE” was expected.

Cause: If OPEN DATASET is not executed in a Unicode Program, and if the user has
“Write” authorization for the file, the file is opened in Read and Write mode. Otherwise,
its opened only in “Read” mode. But if the OPEN DATASET is executed in a Unicode
Program, we need to mention in which mode it should open the dataset.

Solution:

In the Unicode Environment, there are four modes in which the dataset can be opened.

... FOR INPUT


OPEN ... FOR INPUT opens the file in read mode.

... FOR OUTPUT


OPEN ... FOR OUTPUT opens the file in write mode.
If the file already exists, its existing content is deleted. If the file does not exist, the
system creates it.

... FOR APPENDING


OPEN ... FOR APPENDING opens the file in append mode.
If the file already exists, its contents are retained, and the system moves to the end
of the file. If the file does not exist, the system creates it. If the file was already open,
the system moves to the end of the file.

... FOR UPDATE


OPEN ... FOR UPDATE opens the file in read and write mode.

Depending upon the requirement, the user should open the dataset in any of the four
modes to make the program Unicode Compatible.

Example:

Common Unicode Errors Page 25


* OPEN DATASET P_DATASET IN TEXT MODE.
OPEN DATASET P_DATASET FOR INPUT IN TEXT MODE ENCODING
NON-UNICODE.

CASE 11 :

Error : Direct access to components of the global class CL_ABAP_CHAR_UTILITIES is not


possible. CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD statement is missing.
missing).

Solution :

Declare CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD in main program.

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
** End of Changes - 46C To ECC6 - IN9KHOSLA

Case - 16:

Error: In the Unicode context, TRANSLATE... CODEPAGE/NUMBER FORMAT is


not allowed.

Cause: In the TRANSLATE statements, the additions FROM CODEPAGE and


FROM NUMBER FORMAT are not allowed in a Unicode program. New conversion
classes provided to replace these statements. Amongst other things, these classes are a
(possible) replacement for the language elements TRANSLATE … CODEPAGE and
TRANSLATE … NUMBER FORMAT …, which may not be used in Unicode
Programs.

Solution: Data that is not available in ABAP format (that is, text data that is not in the
system code page format, or numeric data that is not in the byte order used on the
application server), is stored in an X field or XSTRING in binary form.
 When converting to an ABAP format from another format, data is read from a
byte sequence and written to an ABAP data object.
 When converting from an ABAP format to another format, data is read from an
ABAP data object and written as a byte sequence.

Common Unicode Errors Page 26


The Classes available for this purpose are:

CL_ABAP_CONV_IN_CE
Converting other formats to ABAP data objects. (Reading a binary input stream).

CL_ABAP_CONV_OUT_CE
Converting ABAP data objects to another format. (Writing to a binary output stream).

CL_ABAP_CONV_X2X_CE
Converting data from one format to another. (Reading from a binary input stream and
writing to a binary output stream).

CL_ABAP_CONV_OBJ
Converting data from one format to another.

Example :

zzmbbpsysm-cpcodepage = '1100'.

* TRANSLATE context-fieldcont
* FROM CODE PAGE zzmbbpcath-cpcodepage
* TO CODE PAGE zzmbbpsysm-cpcodepage.

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


DATA: L_CODEPAGE LIKE tcp0c-charco VALUE '0000'.
CONSTANTS: L_UNICODECP(4) TYPE C VALUE '1100'.

DATA: l_converter TYPE REF TO cl_abap_conv_obj.


DATA: l_out TYPE string.
DATA: l_fromcode TYPE cpcodepage.
DATA: l_tocode TYPE cpcodepage.

Clear: l_out,
l_converter,
l_fromcode,
l_tocode.

l_fromcode = L_CODEPAGE.
l_tocode = L_UNICODECP.

CREATE OBJECT l_converter


EXPORTING
incode = l_fromcode
miss = '.'
broken = '.'
use_f1 = 'X'

Common Unicode Errors Page 27


outcode = l_tocode
EXCEPTIONS
invalid_codepage = 1
internal_error = 2.

IF sy-subrc eq 0.
* Do Nothing.
ENDIF.

CALL METHOD L_CONVERTER->CONVERT


EXPORTING
INBUFF = context
INBUFFLG = 0
OUTBUFFLG = 0
IMPORTING
OUTBUFF = l_out
EXCEPTIONS
INTERNAL_ERROR = 1
others = 2
.
IF sy-subrc eq 0.
context = l_out.
ENDIF.

Clear: l_out,
l_converter,
l_fromcode,
l_tocode.

** End of Changes - 46C To ECC6 - IN9KHOSLA

this is the class to be used for Translate…Codepage/number format.statement

Unicode Error : In the Unicode context, TRANSLATE... CODEPAGE/NUMBER FORMAT is not


allowed.

Before Unicode
TRANSLATE T143T-TBTXT FROM CODE PAGE '1100' TO CODE PAGE '1105'.

After Unicode
Use class for Translate codepage to codepage.
Data : g_codepage LIKE tcp0c-charco VALUE '1100'.
CONSTANTS: c_unicodecp(4) VALUE '1105'.

PERFORM translate_codepage USING g_codepage


c_unicodecp
CHANGING T143T.

FORM translate_codepage USING P_G_CODEPAGE

Common Unicode Errors Page 28


P_C_UNICODECP
CHANGING P_T143T.
DATA: converter TYPE REF TO cl_abap_conv_obj.
DATA: l_out TYPE string.
DATA: l_fromcode TYPE cpcodepage.
DATA: l_tocode TYPE cpcodepage.
l_fromcode = P_G_CODEPAGE.
l_tocode = P_C_UNICODECP.

CREATE OBJECT converter


EXPORTING
incode = l_fromcode
miss = '.'
broken = '.'
use_f1 = 'X'
outcode = l_tocode
EXCEPTIONS
invalid_codepage = 1
internal_error = 2.
IF sy-subrc 0.
CASE sy-subrc.
WHEN 1.
MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
WHEN 2.
MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
ENDCASE.
ENDIF.

CALL METHOD converter->convert


EXPORTING
inbuff = P_T143T
inbufflg = 0
outbufflg = 0
IMPORTING
outbuff = l_out
EXCEPTIONS
internal_error = 1
OTHERS = 2.
IF sy-subrc 0.
CASE sy-subrc.
WHEN 1.
MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
WHEN 2.
MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
ENDCASE.
ENDIF.
P_T143T = l_out.
ENDFORM. " translate_codepage

TRANSLATE l_tab TO CODE PAGE '1100'.

*here its not mentioned that from which code page it has to be translated.

Common Unicode Errors Page 29


*soln: there is a class which could help to findout the default codepage from which it has to be
translated. it is as below.

data: l_codepage(4) type n.

CALL FUNCTION 'SCP_GET_CODEPAGE_NUMBER'


EXPORTING
database_also = ' '
IMPORTING
gui_codepage = l_codepage
EXCEPTIONS
internal_error = 1
OTHERS = 2.
if sy-subrc eq 0.
g_codepage = l_codepage.
endif.

This will give an information on from which codepage we have to transfer it from.

Case - 17:

Error : "SSFCOMPOP" must be a flat structure. You cannot use internal tables,
strings, references, or structures as components. .

Example :

*\PARAMETERS: PRINTER LIKE SSFCOMPOP-TDDEST. "DEFAULT 'BX14'.

Here SSFCOMPOP is a flat structure .So we have to declare variable PRINTER of type
Data element of field TDDEST which is ‘RSPOPNAME’.

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


PARAMETERS: PRINTER type RSPOPNAME. "DEFAULT 'BX14'
** End of Changes - 46C To ECC6 - IN9KHOSLA

Case - 18:

Error : ZZMBBPCAPH cannot be converted to a character-type field.

Solution :

Here ZZMBBPCAPH is a Transparent table.

Common Unicode Errors Page 30


Convert ZZMBBPCAPH into upper case

*\ MESSAGE e019(0q) WITH zzmbbpcaph.

** Begin of Changes - 46C To ECC6 - IN9KHOSLA


MESSAGE e019(0q) WITH 'ZZMBBPCAPH'.
** End of Changes - 46C To ECC6 - IN9KHOSLA
*} REPLACE

"* Begin of Change CONSMD 18/09/2010 RU1K900063 Upgrade to ECC6


Data: lv_FILENAME Type STRING,
lv_PATH Type STRING,
lv_FULLPATH Type STRING,
lv_title type STRING.

lv_title = text-007.

CALL METHOD cl_gui_frontend_services=>file_save_dialog


EXPORTING
window_title = lv_title
CHANGING
filename = lv_filename
path = lv_path
fullpath = lv_fullpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* End of Change CONSMD 18/09/2010 RU1K900063 Upgrade to ECC6
*} REPLACE

IF SY-SUBRC EQ 0. ""Only if name has been changed,


*{ REPLACE RU1K900063 2
*\ FILENAME = UP_FILE. ""copy the new name
* Begin of Change CONSMD 18/09/2010 RU1K900063 Upgrade to ECC6
FILENAME = lv_fullpath. ""copy the new name
* End of Change CONSMD 18/09/2010 RU1K900063 Upgrade to ECC6
*} REPLACE

Common Unicode Errors Page 31


ENDIF.
ENDIF.
"
*{ REPLACE RU1K900063 1
*\ CALL FUNCTION 'WS_FILENAME_GET'
*\ EXPORTING
*\ def_filename = lv_def_filename
*\* def_path =''
*\ mask = ',*.*.'
*\ mode = 'L'
*\* TITLE =''
*\ IMPORTING
*\ filename = lv_file
*\* RC =
*\ EXCEPTIONS
*\ inv_winsys =1
*\ no_batch =2
*\ selection_cancel = 3
*\ selection_error = 4
*\ OTHERS = 5.
* Begin of Change CONSMD 28/09/2010 RU1K900063 Upgrade to ECC6
DATA:lt_files TYPE filetable,
l_file TYPE file_table,
l_title TYPE string,
l_subrc TYPE i,
l_usr_act TYPE i,
l_def_file TYPE string.

l_def_file = lv_def_filename.

CALL METHOD cl_gui_frontend_services=>file_open_dialog


EXPORTING
default_filename = l_def_file
file_filter = '*.*'
CHANGING
file_table = lt_files
rc = l_subrc
user_action = l_usr_act
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error =2
error_no_gui =3
not_supported_by_gui = 4
OTHERS = 5.

LOOP AT lt_files INTO l_file.


MOVE l_file-filename TO l_def_file.
MOVE l_def_file TO lv_file.
EXIT.
ENDLOOP.
* End of Change CONSMD 28/09/2010 RU1K900063 Upgrade to ECC6
*} REPLACE

*Begin of Change CONDAW 29/09/2010 RU1K900063 Upgrade to ECC6


* CALL FUNCTION 'WS_FILENAME_GET'

Common Unicode Errors Page 32


* EXPORTING
* def_filename = ''
* def_path = 'C:\'
* mask = ',*.*,*.*. '
* mode = 'O'
* title = 'Upload File Search From PC'
* IMPORTING
* filename = p_file
** RC =
* EXCEPTIONS
* inv_winsys =1
* no_batch =2
* selection_cancel =3
* selection_error =4
* OTHERS = 5.

DATA:lt_files TYPE filetable,


l_file TYPE file_table,
l_title TYPE string,
l_subrc TYPE i,
l_usr_act TYPE i,
l_def_file TYPE string.

l_def_file = ''.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG


EXPORTING
WINDOW_TITLE = 'Upload File Search From PC'
DEFAULT_FILENAME = l_def_file
FILE_FILTER = ',*.*,*.*. '
CHANGING
FILE_TABLE = lt_files
RC = l_subrc
USER_ACTION = l_usr_act
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR =2
ERROR_NO_GUI =3
NOT_SUPPORTED_BY_GUI = 4
others =5
.

LOOP AT lt_files INTO l_file.


MOVE l_file-filename TO l_def_file.
MOVE l_def_file TO p_file.
EXIT.
ENDLOOP.
*End of Change CONDAW 29/09/2010 RU1K900063 Upgrade to ECC6
**Begin of Changes MOD01
* CALL FUNCTION 'WS_FILENAME_GET'
* EXPORTING
* def_filename = ' '
* def_path = file_pc
* mask = ',Tutti i file *.* ,*.*. '
* mode = 'O'
* title = 'Seleziona file PC'
* IMPORTING
* filename = file_pc
* EXCEPTIONS

Common Unicode Errors Page 33


* inv_winsys = 1
* no_batch = 2
* selection_cancel = 3
* selection_error = 4
* OTHERS = 5.

DATA:lt_files TYPE filetable,


l_file TYPE file_table,
l_title TYPE string,
l_subrc TYPE i,
l_usr_act TYPE i,
l_def_file TYPE string.

l_def_file = ''.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG


EXPORTING
WINDOW_TITLE = 'Upload File Search From PC'
* DEFAULT_EXTENSION = file_pc
DEFAULT_FILENAME = l_def_file
FILE_FILTER = ',Tutti i file *.* ,*.*. '
* WITH_ENCODING =
* INITIAL_DIRECTORY =
* MULTISELECTION =
CHANGING

FILE_TABLE = lt_files
RC = l_subrc
USER_ACTION = l_usr_act
* FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
.
LOOP AT lt_files INTO l_file.
MOVE l_file-filename TO l_def_file.
MOVE l_def_file TO file_pc.
EXIT.
ENDLOOP.

IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

**End of Changes MOD01

**Begin of Changes MOD01


*CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
*EXPORTING
*DEFAULTOPTION = 'Y'
*TEXTLINE1 = TEXT2
*TEXTLINE2 = ' '
*TITEL = TITEL

Common Unicode Errors Page 34


*START_COLUMN = 25
*START_ROW = 6
*IMPORTING
*ANSWER = ANSWER
*EXCEPTIONS
*OTHERS = 1.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = TITEL
* DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = TEXT2
* TEXT_BUTTON_1 = 'Ja'(001)
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = 'Nein'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
ANSWER = ANSWER
* TABLES
* PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
.
**End of Changes MOD01

***************************************************************
The Equivalent Function Module for WS_QUERY-File Exist in ABAP 4.7 is
CL_GUI_FRONTEND_SERVICES=>FILE_EXIST or WS_QUERY-Directory Exist is
CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST.

Sample code for Replacement of WS_QUERY-File Exists is::


data: WK_DIRECTRY(128) TYPE C .
* CALL FUNCTION 'WS_QUERY'
* EXPORTING
* FILENAME = WK_DIRECTRY
* QUERY = 'FE'
* IMPORTING
* RETURN = RC
* EXCEPTIONS
* INV_QUERY = 1
* NO_BATCH = 2
* FRONTEND_ERROR = 3
* OTHERS = 4.
Repleacement Function module is :

Common Unicode Errors Page 35


DATA: W_FILENAME TYPE STRING,
W_RESULT TYPE C.

W_FILENAME = WK_DIRECTRY.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST


EXPORTING
FILE = W_FILENAME
RECEIVING
RESULT = W_RESULT
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF SY-SUBRC 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-* MSGNO WITH SY-
MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF W_RESULT IS INITIAL.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
EXPORTING
DIRECTORY = W_FILENAME
RECEIVING
RESULT = W_RESULT
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
IF SY-SUBRC 0.
ENDIF.
ENDIF.
IF W_RESULT = 'X'.
RC = '1'.
ELSE.
RC = '0'.
ENDIF.

data: nplatform type i.

Common Unicode Errors Page 36


call method cl_gui_frontend_services=>get_platform
receiving
platform = nplatform
exceptions
error_no_gui = 1
cntl_error = 2
not_supported_by_gui = 3
others = 4.

if sy-subrc 0.
ndone = -1.
else.
ndone = 1.
case nplatform.
when cl_gui_frontend_services=>platform_windows95.
return = 'WN32_95'.
when cl_gui_frontend_services=>platform_windows98.
return = 'WN32_98'.
when cl_gui_frontend_services=>platform_nt351.
return = 'WN32'.
when cl_gui_frontend_services=>platform_nt40.
return = 'WN32'.
when cl_gui_frontend_services=>platform_nt50.
return = 'WN32'.
when cl_gui_frontend_services=>platform_mac.
return = 'MC'.
when cl_gui_frontend_services=>platform_os2.
return = 'PM'.
when cl_gui_frontend_services=>platform_linux.
return = 'MF'.
when cl_gui_frontend_services=>platform_hpux.
return = 'MF'.
when cl_gui_frontend_services=>platform_tru64.
return = 'MF'.
when cl_gui_frontend_services=>platform_aix.
return = 'MF'.
when cl_gui_frontend_services=>platform_solaris.
return = 'MF'.
when cl_gui_frontend_services=>platform_macosx.
return = 'MF'.
when 14. "PLATFORM_WINDOWSXP
return = 'WN32'.
when cl_gui_frontend_services=>platform_unknown.
return = '??'.
when others.
return = '??'.
endcase.
endif.

**Begin of Changes MOD01


*CALL FUNCTION 'WS_QUERY'
*EXPORTING
** ENVIRONMENT = ' '
*FILENAME = PATH

Common Unicode Errors Page 37


*QUERY = 'DE'
** WINID = ' '
*IMPORTING
*RETURN = ERR_CODE
*EXCEPTIONS
*INV_QUERY = 1
*NO_BATCH = 2
*FRONTEND_ERROR = 3
*OTHERS = 4.
Data :
W_FILENAME TYPE STRING.
W_FILENAME = PATH.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST


EXPORTING
FILE = W_FILENAME
RECEIVING
RESULT = ERR_CODE
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF ERR_CODE IS INITIAL.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
EXPORTING
DIRECTORY = W_FILENAME
RECEIVING
RESULT = ERR_CODE
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
ENDIF.
IF ERR_CODE = 'X'.
RC = '1'.
ELSE.
RC = '0'.
ENDIF.
**End of Changes MOD01
***********************************
Write error

Common Unicode Errors Page 38


****************************************************************
Program SWO_SET_UC_FLAG

For Unicode flag activation

***************************************************************

This is how it looked before:


PERFORM AUTHORITY(RSAQEXCE) USING 'LFA1'.

And this is how it should look now:

perform authority_begin(rsaqexce) using 'CL_QUERY_TAB_ACCESS_AUTHORITY'.


"NEW in ECC6.

perform authority(rsaqexce) using 'LFA1' 'CL_QUERY_TAB_ACCESS_AUTHORITY'.


"the second parameter is new in ECC 6

perform authority_end(rsaqexce) using 'CL_QUERY_TAB_ACCESS_AUTHORITY'.


"NEW in ECC6

Note : Same for authority form

For type incopitable error


Define below code

data: l_parameter type AQS_CLSNA.

Common Unicode Errors Page 39


l_parameter = 'CL_QUERY_TAB_ACCESS_AUTHORITY'

perform authority_begin(rsaqexce) using


l_parameter.

Field Symbol field giving error

Common Unicode Errors Page 40

You might also like