1. TRANSLATE c TO UPPER CASE.
2. TRANSLATE c TO LOWER CASE.
3. TRANSLATE c USING c1.
4. TRANSLATE c FROM CODE PAGE g1 TO CODE PAGE g2.
5. TRANSLATE c FROM NUMBER FORMAT n1 TO NUMBER FORMAT n2.
As with any string processing statement, all the operands are processed here as type C fields (regardless of type). No internal conversion is performed.
In the field c, converts all lower case letters to upper case or all upper case letters to lower case, as specified.
DATA LETTERS(3). MOVE 'abc' TO LETTERS. TRANSLATE LETTERS TO UPPER CASE.
The field LETTERS now contains 'ABC'.
When the profile parameter abap/locale_ctype is not set
properly when starting the SAP System and/or the character set
is not found, umlaute are not converted.
Replaces the letters in the field c according to the contents of
c1 contains the characters to be replaced in pairs such that the 1st character is replaced by the 2nd character, the 3rd character by the 4th character, and so on. If a character from c is not found in c1, it remains unchanged.
DATA: LETTERS(10) VALUE 'abcX', CHANGE(6) VALUE 'aXBY'. TRANSLATE LETTERS USING CHANGE.
The field LETTERS now contains 'XbcX'.
TRANSLATE c ...FROM CODE PAGE g1 ...TO CODE PAGE g2.
TRANSLATE F TO CODE PAGE G2.
TRANSLATE F FROM CODE PAGE G1.
Performs a character code conversion in the field F. To achieve this, the SAP character code is determined from the conversion table G1 and a new character code derived from G2. You can use the Transaction SPAD to maintain the conversion tables TCP00 - TCP02. If one of the conversion tables does not exist, a runtime error usually occurs. However, there are no runtime errors for conversion combinations maintained at runtime for performance reasons. SPAD will have no influence here.
DATA F(72). TRANSLATE F FROM CODE PAGE '1110' TO CODE PAGE '0100'.
translates the contents of F from the HP character set to EBCDIC
Fields of the types I, P, F and X remain unchanged.
TRANSLATE c ...FROM NUMBER FORMAT n1 ...TO NUMBER FORMAT n2.
TRANSLATE F TO NUMBER FORMAT N1.
TRANSLATE F FROM NUMBER FORMAT N1.
Performs a number format conversion in the field F. The number formats supported at present are '0000' (HP, SINIX, IBM ) and '0101' (DEC alpha OSF). Any attempt to enter formats other than these results in a runtime error. If you omit FROM NUMBER FORMAT or TO NUMBER FORMAT, the system number format is used for the omitted part.
DATA: F TYPE F, HEX (2) TYPE X, NFORM LIKE TCP00-CPCODEPAGE. ... * In /ARCHIV, HEX and F were stored by another platform. * HEX contains the valid number format and can be read on all * platforms. READ DATASET '/ARCHIV' INTO HEX. READ DATASET '/ARCHIV INTO F. NFORM = HEX. "Conversion of machine-independent HEX to NUMC(4) TRANSLATE F FROM NUMBER FORMAT NFORM.
Converts the contents of F from the format NFORM of a platform to the system format.
Type I and F fields are converted.
In the interests of storing additional information for archiving purposes, you can use the function module SYSTEM_FORMAT to display the system code page and system number format.
Converting lower case letters to upper case letters or upper
case letters to lower case letters in a 10-byte long character
field takes approx. 7 msn (standardized microseconds).
Replacing two letters in a 10-byte long field with the variant ... c USING c1 ... takes approx. 9 msn.