‎2008 Jan 30 1:19 PM
Hi gurus,
I have a problem with this statement..
I just give the code: REPLACE ALL OCCURRENCES OF '##' IN l_comment WITH ' '.
when l_comment value is testing##replace, after reach this command, the result should be testing replace, but after i debugged it the result become testingreplace. Is there any symbol for the ' ', except space.. when i use space in the command.. the result still has no space. Thanks..
‎2008 Jan 30 1:34 PM
‎2008 Jan 30 1:21 PM
are you sure there is no additonal CONDENSE statement which you may have overseen?
‎2008 Jan 30 1:26 PM
No condense for the statement replace occurences.. and i need space, not to omitted the space.
‎2008 Jan 30 1:26 PM
Hi,
Try this
Constants: lv_new_line type c value 'CL_ABAP_CHAR_UTILITIES=>NEWLINE'.
REPLACE ALL OCCURRENCES OF lv_new_line IN l_comment WITH space.
Regards,
Satish
‎2008 Jan 30 1:36 PM
Cannot do that, the data consists of ##.. so u must replace the ## with space.. The result still the same, no space between two words.
‎2008 Jan 30 1:43 PM
well normally i´d say the replace commanbd got to work, but this wont help you.
what about doing the thing by hand?
search your_string for '##'.
then the position of ## is beeing stored in sy-fdpos.
you can now split the string into two strings.
lv_fdpos = sy-fdpos + 2.
lv_string1 = your_string(sy-fdpos).
lv_string2 = your_string+lv_fdpos.
and now :
concatenate lv_string1 lv_string2 into your_string separated by space.
‎2008 Jan 30 1:46 PM
Hi,
'##' Represents New Line only. So, better Split the data and move to an internal table.
SPLIT text AT CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO TABLE itab.
If it doesn't work, try these also cl_abap_char_utilites=>cr_lf & cl_abap_char_utilities=>linefeed.
Regards,
Satish
‎2008 Jan 30 1:52 PM
Thank you for ur reply.. put it into internal table.. but doesnt it will time consuming? i already loop the internal table.. the comment is just part of the internal table itself, so by putting into internal table, do u say i must loop the internal table again. And what is the type for the internal table?
‎2008 Jun 20 11:58 AM
do.
REPLACE '##' WITH new INTO lv_c.
FIND FIRST OCCURRENCE OF '##' IN lv_c.
IF sy-subrc IS NOT INITIAL.
EXIT.
ENDIF.
enddo.
‎2008 Jan 30 1:34 PM
‎2008 Jan 30 1:40 PM
The Data can be Hello##World##Many##obstacle..
U cannot use just replace or translate. Thats why i'm using replace all occurences, but the problem is, after replace the '##' with space, the word doesnt have space between them.
‎2008 Jan 30 1:47 PM
Hi,
If so do split it to an itab and concatenate:
like:
DATA:
itab TYPE TABLE OF string,
text TYPE string.
text = `What#a#drag##t is getting old`.
SPLIT text AT '##' INTO TABLE itab.
Regards,
Renjith Michael.
‎2008 Jan 30 1:40 PM
Hi,
You cannot replace entries with SPACE.
Instead try like:
split l_comment at '##' into str1 str2.
clear l_comment.
concatenate str1 str2 into l_comment separated by SPACE.
Hope this will solve ur problem.
Regards,
Renjith Michael.