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: 

Problem in Unicode Conversion

Former Member
0 Kudos

Hello Experts,

As TRANSLATE is obsolate in Unicode version(4.7).. I am using following code to translate.

But The data is not getting translated. Please help.

TYPES: BEGIN OF g_ty_packed,

ttnr(10) TYPE c,

zuord(2) TYPE c,

fuel1(18) TYPE c,

prozent(7) TYPE c,

fuel2(20) TYPE c,

werk(3) TYPE c,

fuel3(20) TYPE c,

END OF g_ty_packed.

DATA: l_view TYPE REF TO cl_abap_view_offlen.

DATA: g_s_packed TYPE g_ty_packed.

DATA: lf_len_x TYPE i,

lo_conv TYPE REF TO cl_abap_conv_in_ce,

l_buffer TYPE xstring.

DATA: lr_conv TYPE REF TO cl_abap_conv_in_ce,

l_xfeld TYPE xstring,

l_encoding TYPE abap_encoding.

FIELD-SYMBOLS: <xfeld>.

ASSIGN g_s_packed TO <xfeld> TYPE 'X'.

l_xfeld = <xfeld>.

lr_conv = cl_abap_conv_in_ce=>create(

encoding = '1610'

input = l_xfeld ).

l_view = cl_abap_view_offlen=>create_unicode16_view(

g_s_packed ).

CALL METHOD lr_conv->read

EXPORTING

view = l_view

IMPORTING

data = g_s_packed.

Here the data has not converted to ASCII, its still displaying in Some different format(####) only

Pls tell me what's wrong in this code..

1 REPLY 1

Former Member
0 Kudos

Hi,

The statement TRANSLATE is not totally obsolete! Only two of its variants should not be used anymore:

1. TRANSLATE dobj [FROM CODE PAGE cp1] [TO CODE PAGE cp2]. 

2. TRANSLATE dobj [FROM NUMBER FORMAT nf1] [TO NUMBER FORMAT nf2].

The non-obsolete variant

TRANSLATE text {TO {UPPER|LOWER} CASE} 
             | {USING pattern}.

can still be used.

I can't tell you what's wrong with your coding, but simply try the conventional solution.

Good luck,

Heinz