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.
TRANSLATE c TO UPPER CASE.
TRANSLATE c TO LOWER CASE.
In the field c , converts all lower case letters
to upper case or all upper case letters to lower case, as specified.
MOVE 'abc' TO LETTERS.
TRANSLATE LETTERS TO UPPER CASE.
The field LETTERS now contains 'ABC' .
TRANSLATE c USING c1.
Replaces the letters in the field c according to
the contents of c1 .
If a character in c also exists in c1, it is replaced by the letter
that f o l l o w s it in c1. If a character from c is not found in
c1, it remains unchanged.
The field LETTERS now contains 'XbcX' .
DATA: LETTERS(10) VALUE 'abcX',
CHANGE(6) VALUE 'aXBY'.
TRANSLATE LETTERS USING CHANGE.
TRANSLATE c ...FROM CODE PAGE g1 ...TO CODE PAGE
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 .
translates the contents of F from the HP character set
to EBCDIC ( IBM 274).
TRANSLATE F FROM CODE PAGE '1110' TO CODE PAGE '0100'.
Type I , P , F and X fields
remain unchanged. Field strings and work areas of internal tables are
converted to the correct type for each individual field. At present,
table work areas (as defined in TABLES ... ) are not treated
according to type, but are converted as a whole. If necessary, declare
a field string with INCLUDE STRUCTURE and then perform a
TRANSLATE c ...FROM NUMBER FORMAT n1 ...TO NUMBER
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 was stored by another platform from HEX and F.
* HEX contains the valid number format and can be read on all
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. Field
strings and work areas of internal tables are converted to the correct
type for each individual field. Table work areas (as defined with
TABLES ... ) are treated as type C at present and are
not converted. If necessary, declare a field string with
INCLUDE STRUCTURE and then perform a conversion.
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
Replacing two letters in a 10-byte long field with the variant ...
c USING c1 ... takes approx. 9 msn.
TRANSLATE_WRONG_NUM_FORMAT : Invalid number format.
© SAP AG 1996