Application Development and Automation 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: 
Read only

Alternate for Translate Code Page

Former Member
0 Likes
2,207

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

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

4 REPLIES 4
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,036

Hi,

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

and the method <b>CONVERT</b>

Regards,

Sesh

Read only

Former Member
0 Likes
1,036

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

Read only

0 Likes
1,036

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

Read only

Former Member
0 Likes
1,036

Thanks