‎2008 May 20 10:41 AM
Hi Experts,
i have a string have values separated by tabular spaces eg
19 asd 23 adf 23
i need to replace the string like this
19,asd,23,adf,23
thanks in advance
‎2008 May 20 10:47 AM
‎2008 May 20 10:50 AM
Hi Karthick,
In our code, use the following Syntax,
REPLACE ALL OCCURENCES OF ' ' WITH ',' RESPECTING BLANKS.
Hope this is helpful to you. If you need further information, revert back.
Reward all the helpful answers.
Regards
Nagaraj T
‎2008 May 20 10:52 AM
Hi,
use the following code
DATA: w_text TYPE char10.
CONSTANTS: c_colon TYPE char1 VALUE ','.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN w_text WITH c_colon.
cl_abap_char_utilities=>horizontal_tab takes tablular space.
Reward points if helpful.
Regards,
Sriram
Edited by: Srirama Murthy Maddirala on May 20, 2008 11:54 AM
‎2008 May 20 10:57 AM
Hi,
Kindly use the following sample code:
DATA: VAR1(10) VALUE 'sau rabh',
LENGTH TYPE I,
START TYPE I.
LENGTH = STRLEN( VAR1 ).
DO LENGTH TIMES.
IF VAR1+START(1) EQ SPACE.
VAR1+START(1) = ','.
ENDIF.
START = START + 1.
ENDDO.
I know the logic to get the blank space is tedious but the problem is u cannot use REPLACE statement directly.
hopefully it helps.
Regards,
Saurabh
‎2008 May 20 11:17 AM
Hi..
try this logic.
DATA: var1(80) VALUE '19 asd 23 adf 23',
length TYPE i,
start TYPE i.
CONDENSE var1.
length = strlen( var1 ).
DO length TIMES.
IF var1+start(1) EQ space.
var1+start(1) = ','.
ENDIF.
start = start + 1.
ENDDO.
WRITE: var1.
i hope this will solve your problem.
Regards,
N M Poojari.