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

Srisap
Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

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

9 REPLIES 9

Former Member
0 Kudos

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

former_member181962
Active Contributor
0 Kudos

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

0 Kudos

Can you give me an example of the class u have mentioned..

Sri.

Former Member
0 Kudos

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

0 Kudos

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.

0 Kudos

If you are on 4.7 or higher, try transaction UCCHECK. The unicode explanations are more detailed then the editor does.

former_member181962
Active Contributor
0 Kudos

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

0 Kudos

Thx a lot ravi

Sri

0 Kudos

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