04-26-2006 4:31 PM
Ji,
i have a variable of char with a text that is in lowercase and with accents, and i want to convert it to uppercase and no accents. Like this
i have: olá cão
and i want like this: OLA CAO
04-26-2006 4:33 PM
See:
http://help.sap.com/SAPHelp_46c/helpdata/EN/fc/eb33a5358411d1829f0000e829fbfe/frameset.htm
Before translate to upper case, you need replace like this:
translate lc_char to upper case.
REPLACE 'Á' with 'A' into lc_char.
REPLACE 'É' with 'E' into lc_char.
REPLACE 'Í' with 'I' into lc_char.
REPLACE 'Ó' with 'O' into lc_char.
REPLACE 'Ú' with 'U' into lc_char.
Reward points if helps.
04-26-2006 4:33 PM
HI,
Go for Translate
Syntax
1. TRANSLATE c TO UPPER CASE.
2. TRANSLATE c TO LOWER CASE.
3. TRANSLATE c USING r.
4. TRANSLATE c ...FROM CODE PAGE g1... TO CODE PAGE g2.
5. TRANSLATE f ...FROM NUMBER FORMAT n1... TO NUMBER FORMAT n2.
U can even go for
Pattern-Based Replacing
REPLACE
[ FIRST OCCURRENCE OF | ALL OCCURRENCES OF ]
[ SUBSTRING ] old
IN [ SECTION OFFSET off LENGTH len OF ] text
WITH new.
Please mark the helfull answers & close the thread if ur problem is solved
Regards
Manoj
Message was edited by: Manoj Gupta
04-26-2006 4:47 PM
hi Ricardo,
Use <b>Translate</b> Statement
<b>Converting to Upper or Lower Case or Replacing Characters</b>
The TRANSLATE statement converts characters into upper or lower case, or uses substitution rules to convert all occurrences of one character to another character.
<b>Converting to Upper or Lower Case</b>
TRANSLATE <c> TO UPPER CASE.
TRANSLATE <c> TO LOWER CASE.
These statements convert all lower case letters in the field <c> to upper case or vice versa.
Substituting Characters
TRANSLATE <c> USING <r>.
This statement replaces all characters in field <c> according to the substitution rule stored in field <r> . <r> contains pairs of letters, where the first letter of each pair is replaced by the second letter. <r> can be a variable.
For more variants of the TRANSLATE statement with more complex substitution rules, see the keyword documentation in the ABAP Editor.
DATA: T(10) VALUE 'AbCdEfGhIj',
STRING LIKE T,
RULE(20) VALUE 'AxbXCydYEzfZ'.
STRING = T.
WRITE STRING.
TRANSLATE STRING TO UPPER CASE.
WRITE / STRING.
STRING = T.
TRANSLATE STRING TO LOWER CASE.
WRITE / STRING.
STRING = T.
TRANSLATE STRING USING RULE.
WRITE / STRING.
Output:
AbCdEfGhIj
ABCDEFGHIJ
abcdefghij
xXyYzZGhIj
http://help.sap.com/saphelp_erp2005/helpdata/en/fc/eb33a5358411d1829f0000e829fbfe/frameset.htm
Regards,
Santosh
Note: Please Mark the Helpful Answers
04-26-2006 4:53 PM
HI ricardo,
you can translate using rules..
like this,
DATA: T(10) VALUE 'olá cão',
STRING LIKE T,
RULE(20) VALUE 'áAãA'.
STRING = T.
TRANSLATE STRING USING RULE.
TRANSLATE STRING TO UPPER CASE.
WRITE / STRING.
in the rule ..
the first character is the one you want to change to tyhe second character..i.e from á to A..
and similarly from 3rd to 4th and so on..
you can keep adding your rules..
regards
satesh
04-26-2006 4:53 PM
You can also use the FMS
2054_TRANSLATE_2_UPPERCASE
AIPC_CONVERT_TO_UPPERCASE
HR_99S_CONV_UPPER_CASE
K_CATT_CONVERT_UPPER_CASE
STRING_UPPER_LOWER_CASE
TERM_TRANSLATE_TO_UPPER_CASE
TR_UPPERCASE_PARTS_OF_STRING
SWA_STRING_TO_UPPERCASE
SWF_SWCONT_TO_UPPER_CASE
<b>Tip: Go to->SE37 and search "upper*".</b>
Thanks
Saquib