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

trnaslate string from Code Page

Former Member
0 Likes
788

TRANSLATE str_file FROM CODE PAGE '1100' TO CODE PAGE '4110'.

What is the use of this statement and while upgrade do i need to change the code page.

Points will be rewarded

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
656

Hi,

Reference SAP help :

TRANSLATE c ...FROM CODE PAGE g1 ...TO CODE PAGE g2.

Parts marked with " ..." are interchangeable

TRANSLATE c TO CODE PAGE g2.

TRANSLATE c FROM CODE PAGE g1.

Instead you can use conversion classes.

Effect

Converts the contents of the field c from character set g1 to character set g2. This variant uses the conversion table g1 to determine the SAP character, which is then used to determine the new character from g2.

Transaction SPAD allows you to display and maintain character sets. If one of the conversion tables does not exist, the runtime error CONVERSION_CODEPAGE_UNKNOWN occurs. Conversion combinations that are maintained as part of the runtime system for performance reasons do not trigger runtime errors, and you cannot change them using Transaction SPAD.

Example

DATA c(72) TYPE C.

TRANSLATE c FROM CODE PAGE '1110' TO CODE PAGE '0100'.

This statement converts the contents of field c from the HP-UX character set to IBM EBCDIC.

Note

Fields with types I, P, F, and X remain unchanged by the conversion. The syntax check only allows character fields for specifying the codepage. However, since the codepage is maintained in table TCP00 as a type N field with length 4, you should use this type.

Reward if helpful,

Regards,

Esha Raj

2 REPLIES 2
Read only

Former Member
0 Likes
657

Hi,

Reference SAP help :

TRANSLATE c ...FROM CODE PAGE g1 ...TO CODE PAGE g2.

Parts marked with " ..." are interchangeable

TRANSLATE c TO CODE PAGE g2.

TRANSLATE c FROM CODE PAGE g1.

Instead you can use conversion classes.

Effect

Converts the contents of the field c from character set g1 to character set g2. This variant uses the conversion table g1 to determine the SAP character, which is then used to determine the new character from g2.

Transaction SPAD allows you to display and maintain character sets. If one of the conversion tables does not exist, the runtime error CONVERSION_CODEPAGE_UNKNOWN occurs. Conversion combinations that are maintained as part of the runtime system for performance reasons do not trigger runtime errors, and you cannot change them using Transaction SPAD.

Example

DATA c(72) TYPE C.

TRANSLATE c FROM CODE PAGE '1110' TO CODE PAGE '0100'.

This statement converts the contents of field c from the HP-UX character set to IBM EBCDIC.

Note

Fields with types I, P, F, and X remain unchanged by the conversion. The syntax check only allows character fields for specifying the codepage. However, since the codepage is maintained in table TCP00 as a type N field with length 4, you should use this type.

Reward if helpful,

Regards,

Esha Raj

Read only

Former Member
0 Likes
656

Hi,

Just had a quich look, translate is not allowed in unicode programs. You need use one of cl_abap_conv* classes instead

Regards,

Raj.