SAP TRANSLATE ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID TRANSLATE
• TRANSLATE ABAP Statement

TRANSLATE
Short Reference

ABAP_SYNTAX
TRANSLATE text ${TO ${UPPER$|LOWER$} CASE$}
$| ${USING mask$}.

ABAP Addition
1 ... TO ${UPPER$|LOWER$} CASE
2 ... USING mask

What does it do?
This statement translates the individual characters of the character-like variable text. Either CASE can be used to translate the case or USING can be used for a translation according to a pattern. The variable text must be a character-like variable.
• TO UPPER CASE TRANSLATE
• TO LOWER CASE TRANSLATE

ABAP Addition

What does it do?
If UPPER is specified, all lowercase letters of the data object text are translated to uppercase. If LOWER is specified, all uppercase letters are translated to lowercase.



Latest notes:

To change the case of the letters in a character string in an operand position, a case function can be used that includes the functions of the statement TRANSLATE.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
After the translation, the variable text contains CAREFUL WITH THAT AXE, EUGENE.
ABEXA 00709
ABAP_EXAMPLE_END
• USING TRANSLATE

ABAP Addition

What does it do?
If USING is specified, the characters in text are translated in accordance with the rule specified in the data object mask. mask is a character-like expression position whose value is interpreted as a string of character pairs. Starting with the first pair, a search is performed in text for the first character in every pair and each occurrence is replaced with the second character of the pair. The search is case-sensitive. If mask contains a character multiple times as the first character of a pair, only the first pair is respected. A character in text that has already been replaced cannot be replaced again in the same TRANSLATE statement. Therefore, if the second character of a pair in mask is listed as the first character of a subsequent pair, the second pair affects only the original characters in text.
Trailing blanks in data objects text and mask are respected for data objects. If mask contains an odd number of characters, the last character is ignored. If mask is an empty string, no replacements are made.



Latest notes:

To translate a character string in an operand position, a translate function that includes the functions of the statement TRANSLATE can also be used.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Translation of the characters A to B, a to b and back. After execution, text contains Abracadabra.
ABEXA 00710
ABAP_EXAMPLE_END

Return to menu