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

Unicode Conversion

Former Member
0 Likes
819

I am presently working in Unicode conversion .

There is a statement in sap 4.6C as mentioned below .

Character are converted from HP character format to IBM format

TRANSLATE I_OUTPUT_DATASET FROM CODE PAGE V_FROM_CODEPAGE TO CODE PAGE V_TO_CODEPAGE

V_FROM_CODEPAGE = 1100

V_TO_CODEPAGE = 0199

But when I tried to execute in the Unicode enviornment the above statement is obsolete .

So please send how to change the present text to this format .

6 REPLIES 6
Read only

rainer_hbenthal
Active Contributor
0 Likes
789

Why dont you use the online help to figure out on howto replace the TRANSLATE statement?

Read only

0 Likes
789

Hi ,

Thank you for the suggestion .

But I didn't find any such help from the online .

Read only

0 Likes
789

Hi Bhaskar,

Translate is Obsolete now . You need to use Classes

CL_ABAP_CONV_IN_CE - External to System Format

CL_ABAP_CONV_OUT_CE - System Format to External Format.

Thanks,

Rema.

Read only

0 Likes
789

Position the cursor on TRANSLATE, press F1. Read. There is a paragraf saying translate is obsolet and what do use instead.

Read only

0 Likes
789

Hi,

Thank you .But this only gives the syntax i.e

To UPPER /LOWER case .

Using Pattern .

But it is solving my present problem

Read only

Former Member
0 Likes
789

Hi Bhaskar,

Try the below code.

report znk_sdn.

data : in_buffer type xstring,

out_buffer type xstring,

conv type ref to cl_abap_conv_x2x_ce,

str1 type string value '?',

x type xstring.

convert text str1 into sortable code x.

write: x, ' '.

convert text '-' into sortable code x.

write x.

in_buffer = '414220C3B602010000'.

conv = cl_abap_conv_x2x_ce=>create( in_encoding = 'UTF-8'

in_endian = 'L'

out_encoding = '1100'

out_endian = 'B'

input = in_buffer ).

call method conv->convert_c( n = 5 ).

out_buffer = conv->get_out_buffer( ).

write out_buffer.

In the same way you can use below classes.

CL_ABAP_CONV_IN_CE

Reading data from a byte-like data object and converting from an external format to the system format.

CL_ABAP_CONV_OUT_CE

Converting data from the system format to an external format and writing in a byte-like data object.

CL_ABAP_CONV_X2X_CE

Converting data from an external format to another external format.