2008 Mar 04 11:43 AM
Hai all,
can any1 explain abt translate keyword(string concept).
nt able to get it......plz
Hai all,
can any1 explain abt translate keyword(string concept).
nt able to get it......plz
2008 Mar 04 11:45 AM
Hi,
TRANSLATE
Converts characters to strings.
Syntax
TRANSLATE <c> TO UPPER|LOWER CASE
|USING <r>.
The characters of the string <c> are converted into upper- or lowercase, or according to a substitution rule specified in <r>.
Regards,
Priya.
2008 Mar 04 11:47 AM
hi,,
sample code is,
data wi(30) type c.
wi = 'hello'.
write:/ wi.
translate wi to upper case.
write 😕 wi.
output..
HELLO
Hope this helps u,
Arunsri
2008 Mar 04 11:50 AM
<h1>TRANSLATE</h1>
Syntax
TRANSLATE text {TO {UPPER|LOWER} CASE}
| {USING pattern}.
Extras:
1. ... TO {UPPER|LOWER} CASE
2. ... USING pattern
Effect
This statement converts the case or single characters of the character-type data object text. The statement CASE can be used for the conversion to upper/lower case; USING can be used for the conversion according to a pattern. The variable text must be character-type.
Note
There are two obsolete variants of this statement:
Addition 1
... TO {UPPER|LOWER} CASE
Effect
If you specify UPPER, all lower-case letters of the data object text are converted to upper case. If you specify LOWER, all upper-case letters are converted to lower case.
Note
The conversion of the upper/lower case depends on the text environment. Problems may occur if the language of the text environment differs from the language in which the data to be processed is entered. Data loss will occur if a conversion between the source and target language has not been defined. To avoid this type of inconsistency, you must appropriately set the text environment using the SET LOCALE statement prior to the conversion.
Example
After the conversion, the variable text contains "CAREFUL WITH THAT AXE, EUGENE".
DATA text TYPE string.
text = `Careful with that Axe, Eugene`.
TRANSLATE text TO UPPER CASE.
Addition 2
... USING pattern
Effect
If you specify USING, the characters in text are converted according to the rule specified in pattern. pattern must be a character-type data object whose contents are interpreted as a sequence of character pairs. text is searched for the first character of each pair, starting with the first pair, and each location found is replaced with the second character of the pair. The search is case-sensitive. If pattern contains a character multiple times as the first character of a pair, only the first pair is taken into account. 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 pattern appears 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 pattern are taken into account for data objects. If pattern contains an uneven number of characters, the last character is ignored. If pattern is a blank string, no replacements take place.
Example
Converts the characters "A" to "B", "a" to "b", and vice versa. text contains "Abracadabra" after the conversion.
DATA text TYPE string.
text = `Barbcbdbarb`.
TRANSLATE text USING 'ABBAabba'.
Regards,
Chandru
2008 Mar 04 11:50 AM
Hi,
suppose u have a variable w_acct having a length of 12 but u have given w_acct = 89789.
now i declare a constant of length 2 c_translate = ' 0'.ie space is the first char and 0 is the second char.
now if u use
TRANSLATE w_acct using c_translate .
This will replace the occurence of space by zeros.So it takes in pairs and replaces the first char by the second char in the string.
so now w_acct = 897890000000.
reward points if useful.
regards,
Sowmya.
2008 Mar 04 11:53 AM
hi
check the folowing link
http://scholar.google.com/scholar?q=translatekeywordin+ABAP&hl=en&um=1&ie=UTF-8&oi=scholart
http://www.abap2java.com/Category:Keyword_ABAP
http://sap.ionelburlacu.ro/abap/sap2/Beautify_Source_Code.html
http://voiceofabap.blogspot.com/2008/01/translate-keyword-description-and.html
Regards,
Sreelatha gullapalli
2008 Mar 04 12:21 PM
Hai sowmya,
can u explain translate in dis code......
Convert PDF from 132 to 255.
LOOP AT i_pdf.
Replacing space by ~
TRANSLATE i_pdf USING '~'.
CONCATENATE w_buffer i_pdf INTO w_buffer.
ENDLOOP.
Replacing ~ by space
TRANSLATE w_buffer USING '~'.
DO.
i_record = w_buffer.
Appending 255 characters as a record
APPEND i_record.
SHIFT w_buffer LEFT BY 255 PLACES.
IF w_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |