Skip to Content

Unicode

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.

Add comment
10|10000 characters needed characters exceeded

4 Answers

  • Best Answer
    Posted on Oct 24, 2005 at 10: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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2005 at 09: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

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 24, 2005 at 09: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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2005 at 09: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

    Add comment
    10|10000 characters needed characters exceeded