‎2007 Nov 20 6:49 AM
I have a string which value is 'abc eee bbb ccc'. I would like to remove all space and the result is abceeebbbccc. How can i do that. Thanks!
‎2007 Nov 20 6:51 AM
Hi,
use CONDENSE statement
<b>CONDENSE V_STR NO-GAPS.</b>
Regards,
Omkar.
‎2007 Nov 20 6:51 AM
‎2007 Nov 20 6:52 AM
use following line of code...
REPLACE ALL OCCURANCES OF ' ' IN STR1 WITH ''.
‎2007 Nov 20 6:54 AM
try this,
x type string value 'ak fkfg'.
CONDENSE x NO-GAPS.
reward points if useful.
Regards,
Vimal
‎2007 Nov 20 7:18 AM
Hi, Portfolio.
I found this in SAP Library, hope this can help you.
The CONDENSE statement deletes redundant spaces from a string:
CONDENSE <c> [NO-GAPS].
This statement removes any leading blanks in the field <c> and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.
DATA: STRING(25) VALUE ' one two three four',
LEN TYPE I.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.
CONDENSE STRING.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.
CONDENSE STRING NO-GAPS.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.
Output:
one two three four !
Length: 25
one two three four !
Length: 18
onetwothreefour !
Length: 15
Note that the total length of the field STRING remains unchanged, but that the deleted blanks appear again on the right.
Regards,
feng.
‎2007 Nov 20 7:27 AM
data : str type string value 'kiran kumar'.
condense str no-gaps.
write:/ str.
i will check this code this is working.plz check it once.
ANOTHER TYPE:
DATA: FIELD(10) VALUE 'abcde'.
WRITE: / '|' NO-GAP, FIELD LEFT-JUSTIFIED NO-GAP, '|',
/ '|' NO-GAP, FIELD CENTERED NO-GAP, '|',
/ '|' NO-GAP, FIELD RIGHT-JUSTIFIED NO-GAP, '|'.
Output: |abcde |
| abcde |
| abcde|