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

translate error in unicode conversion

Former Member
0 Likes
1,555

hi all .

while i'm doin unicode conversion . i'm getting translate codepage error . pls anybody help me out in this issue . thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,333

Hi,

Do UCCHECK for your program and see where it si giving Transalte error and after that you can follow these steps.

*******************************************

If u got * u2018Dangerous use of Translate in Multilingual system.u2019* Error

Correction:

To correct the Error occurring on TRANSLATE statement u2013 use this additional statement before the Translate statement.

SET LOCALE LANGUAGE sy-langu.

This statement defines the Text Environment of all the programs & internal sessions in the language specified in the LANGUAGE KEY, which in this case is u201Csy-languu201D, i.e. the log on language of the user.

***********************

Regards,

Syed

8 REPLIES 8
Read only

GauthamV
Active Contributor
0 Likes
1,333

hi,

use UCCHECK transaction.

Read only

Former Member
0 Likes
1,333

hi,

u need use *set locale* for that error ...

thank u

santhosh

Read only

0 Likes
1,333

set locale is for translate to upper case .. my error is .. when we translate from one codepage to another codepage . while din unicode up-gradtion . thanks

Read only

Former Member
0 Likes
1,334

Hi,

Do UCCHECK for your program and see where it si giving Transalte error and after that you can follow these steps.

*******************************************

If u got * u2018Dangerous use of Translate in Multilingual system.u2019* Error

Correction:

To correct the Error occurring on TRANSLATE statement u2013 use this additional statement before the Translate statement.

SET LOCALE LANGUAGE sy-langu.

This statement defines the Text Environment of all the programs & internal sessions in the language specified in the LANGUAGE KEY, which in this case is u201Csy-languu201D, i.e. the log on language of the user.

***********************

Regards,

Syed

Read only

Former Member
0 Likes
1,333

Hi,

DATA: BEGIN OF REC1,

LANGE(4) TYPE X,

SATZA(1),

BKLTZ1(5) TYPE P,

BKLTZ2(5) TYPE P,

KONTO1(6) TYPE P,

BF1(6) TYPE P,

BF2(7) TYPE P,

TXTSCHL1(1) TYPE P,

TXTSCHL2(2) TYPE P,

BF3(1),

WRBTR(6) TYPE P,

BKLTZ3(5) TYPE P,

KONTO(6) TYPE P,

INTNR(6) TYPE P,

BF4(3),

NAME1(27),

NAME2(27),

VRWZW(27),

C17A_WAEHRUNGSKENNZ(1),

C17B(2),

EWKZG(2) TYPE P.

DATA: END OF REC1.

FIELD-SYMBOLS: <C_REC1> TYPE C,

<C_V_RECSAV> TYPE C.

DATA: BEGIN OF REC1_C, "Take only character fields in this internal table

SATZA(1),

BF3(1),

BF4(3),

NAME1(27),

NAME2(27),

VRWZW(27),

C17A_WAEHRUNGSKENNZ(1),

C17B(2).

DATA: END OF REC1_C.

DATA : G_OUT1 LIKE REC1_C.

-


-


READ DATASET P_INDAT INTO V_RECSAV.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

    • TRANSLATE REC1 FROM CODE PAGE '0100' TO CODE PAGE '1100'.*

*Replace the above statement with the code below

ASSIGN REC1 TO <C_REC1> CASTING.

ASSIGN V_RECSAV TO <C_V_RECSAV> CASTING.

<C_REC1> = <C_V_RECSAV>.

MOVE-CORRESPONDING REC1 TO REC1_C.

PERFORM TRANSLATE_CODEPAGE USING '0100'

'1100'

CHANGING REC1_C G_OUT1.

MOVE-CORRESPONDING REC1_C TO REC1.

-


-


FORM TRANSLATE_CODEPAGE USING P_G_CODEPAGE

P_C_UNICODECP

CHANGING P_T143T TYPE ANY

P_L_OUT TYPE ANY .

DATA: CONVERTER TYPE REF TO CL_ABAP_CONV_OBJ.

DATA: L_OUT TYPE XSTRING.

FIELD-SYMBOLS <C_L_OUT> TYPE XSTRING.

DATA: L_FROMCODE TYPE CPCODEPAGE.

DATA: L_TOCODE TYPE CPCODEPAGE.

DATA : TP_CODEPAGE TYPE CPNORMCP,

TP_INBUFF TYPE I,

TP_OUTBUFF TYPE I.

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 = P_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 = P_L_OUT.

ENDFORM. " TRANSLATE_CODEPAGE

Read only

0 Likes
1,333

hi . thanks for the which u sent me .. is there any related note for this codepage error . i was searching but i could not able find out notes for this error .pls let me know notes . thanks

Read only

0 Likes
1,333

Hi,

I am not sure about the note available. But Translate statement will not work in unicode systems.

Actually Fields with types I, P, F, and X remain unchanged by the conversion using translate statement, only character fields will be converted. So we have to move all character fields to separate structure and call the subroutine TRANSLATE_CODEPAGE which i have sent u which does the operation similar to u r translate statement.

Read only

0 Likes
1,333

hi ,

thanks you ur reply .