10-24-2005 9:56 AM
Hello All,
I got a problem with unicode check...
Following is the snippet of the code..
DATA: OEFLT(1) TYPE X VALUE 'CE',ASBEN(30) TYPE C.
REPLACE OEFLT WITH 'ö' INTO ASBEN.----> Unicode error...
How do I do this..
Thx in advance,,
Sri.
10-24-2005 11:44 AM
Hi Sridhar,
Use the function module NLS_STRING_CONVERT_TO_SYS for all conversions of Hexadecimal values.
This code will give you an idea of how do we go about , when we get these type of errors.
REPORT ZV1_TEST19 .
DATA: CR TYPE X VALUE '0D',
LF TYPE X VALUE '0A',
tab type x value '09'.
data:v_info(12) type c value '121#232 33'.
data: v_sep type x value '7C',
v_xstr type xstring,
v_ch type string,
v_ch1 type c.
class cl_abap_char_utilities definition load.
constants:v_crlf(2) type c value cl_abap_char_utilities=>cr_lf.
data:v_cr type c,
v_lf type c.
v_cr = v_crlf+0(1).
v_lf = v_crlf+1(1).
write:/ v_cr,v_lf.
v_xstr = v_sep.
call function 'NLS_STRING_CONVERT_TO_SYS'
exporting
lang_used = sy-langu
source = v_xstr
IMPORTING
RESULT = v_ch
SUBSTED =
EXCEPTIONS
ILLEGAL_SYST_CODEPAGE = 1
NO_FE_CODEPAGE_FOUND = 2
COULD_NOT_CONVERT = 3
OTHERS = 4.
v_ch1 = v_ch.
write:/ cr,
lf,
tab.
Thanks,
Ravi
10-24-2005 10:17 AM
Hi Sri,
The error is very clearly described during syntax check -
"OEFLT" must be a character-type data object (data type C, N, D, T, or STRING)
The variable you have declared is of type X, and hence the error.
I am not sure of what you are trying to do with the REPLACE statement, though.
Sudha
Message was edited by: Sudha Mohan
10-24-2005 10:22 AM
Hi Sridhar,
The resolution of your problem would be declaring a constant of type abap utilities class static variable which corresponds to the hexadecimal value 'CE' and use it in the place of PFELT.
Thanks,
Ravi Kanth Talagana
10-24-2005 11:46 AM
10-24-2005 10:22 AM
does this serve your purpose....
DATA: oeflt(1) TYPE x VALUE 'CE',asben(30) TYPE x.
data test(1) type x value 'ö'.
REPLACE oeflt WITH test INTO asben IN BYTE MODE.
rgds,
PJ
10-24-2005 11:43 AM
Hi,
Currently I m on an upgrade project. So the programs which I m going thru are not mine, and basically I don't know what the program is meant for....
Doing a unicode check gave me this error message and what will be the output of the above statement even i m not sure....
Is th hexadecimal value of 'ö' = 00?
Anywaz thx for all the help...
Anymore suggestion are welcomed..
Sri.
10-24-2005 11:44 AM
If you are on 4.7 or higher, try transaction UCCHECK. The unicode explanations are more detailed then the editor does.
10-24-2005 11:44 AM
Hi Sridhar,
Use the function module NLS_STRING_CONVERT_TO_SYS for all conversions of Hexadecimal values.
This code will give you an idea of how do we go about , when we get these type of errors.
REPORT ZV1_TEST19 .
DATA: CR TYPE X VALUE '0D',
LF TYPE X VALUE '0A',
tab type x value '09'.
data:v_info(12) type c value '121#232 33'.
data: v_sep type x value '7C',
v_xstr type xstring,
v_ch type string,
v_ch1 type c.
class cl_abap_char_utilities definition load.
constants:v_crlf(2) type c value cl_abap_char_utilities=>cr_lf.
data:v_cr type c,
v_lf type c.
v_cr = v_crlf+0(1).
v_lf = v_crlf+1(1).
write:/ v_cr,v_lf.
v_xstr = v_sep.
call function 'NLS_STRING_CONVERT_TO_SYS'
exporting
lang_used = sy-langu
source = v_xstr
IMPORTING
RESULT = v_ch
SUBSTED =
EXCEPTIONS
ILLEGAL_SYST_CODEPAGE = 1
NO_FE_CODEPAGE_FOUND = 2
COULD_NOT_CONVERT = 3
OTHERS = 4.
v_ch1 = v_ch.
write:/ cr,
lf,
tab.
Thanks,
Ravi
10-24-2005 11:52 AM
12-20-2021 7:05 PM
Hello, I used the NLS_STRING_CONVERT_TO_SYS function module, but it always returns the same hex value '23002300' -> ##.
The input value is 0900 and 0A00. you know why ? thanks for your help.
The value I expect is # -> 0900 and # -> 0A00