Skip to Content
avatar image
Former Member

Alternate for Translate Code Page

Hi,

i am doing Upgradation from 4.6c to ECC6.0. During Unicode check i got a problem for code of line “Translate field to CODE PAGE ‘1103’.

The error is that “Translate to CODE PAGE/FORMAT is not supported in ECC6.0.”

I think Translate to Code Page is obselete in Ecc 6.0 . Please send the alternate way of achieving it with sample code.

Regards,

Niyaz Ahamed

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jun 15, 2007 at 05:15 AM

    This is how to do it.

    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

    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

    Referred how to use class for Translate..codepage/numer format

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Niyaz Ahamed,

      I am in upgradation project.

      I am getting the error like

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

      My statement is

      TRANSLATE REC_ATAB FROM CODE PAGE SYS_CODEPAGE

      TO CODE PAGE CODEPAGE_1100

      Can you please help me in resolving this issue? Do i need to replace this statement with any other statements?

      I would like to resolve this issue ASAP as this is urgent issue for Business,

      Thanks in advance.

      Ramesh

  • Jun 15, 2007 at 04:59 AM

    Hi,

    You can use this class <b>CL_ABAP_CONV_IN_CE</b>

    and the method <b>CONVERT</b>

    Regards,

    Sesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 15, 2007 at 05:15 AM

    Thanks

    Add comment
    10|10000 characters needed characters exceeded