‎2008 Nov 05 9:17 AM
Hi Experts,
I need to replace ',' with space in one field.
I am using following syntax but its not working help me
REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.
REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH SPACE.
Both are not working, so need ur help.
Thanks
Basu
‎2008 Nov 05 9:20 AM
Hope you loop the itab to make this change .
Loop itab.
REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.
---> You need to use modify itab to make the change permanent
endloop.
‎2008 Nov 05 9:20 AM
try using TRANSLATE:
TRANSLATE itab-xyz USING ', '. "pls. not there is a space after the comaalso check if itab-xyz has any value when the statement is reached
‎2008 Nov 05 9:21 AM
data: output type string.
create an itab of type text.
split <string> at ',' into table <itab>.
loop at itab.
concatenate output <itab-field> into output separated by space.
endloop.
- Hemant
‎2008 Nov 05 9:37 AM
>
> REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.
> REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH SPACE.
>
You have to use IN TABLE itab instead of IN itab-xyz.
REPLACE ALL OCCURRENCES OF ',' IN TABLE itab WITH SPACE.Regards
Karthik D
Edited by: Karthik D on Nov 5, 2008 3:07 PM
‎2008 Nov 05 10:52 AM
Hi,
I have recently worked with the same syntax. It is working fine for me. Please check this out.
LOOP AT t_itab ASSIGNING <fs_t_itab>.
CHECK <fs_t_itab> IS ASSIGNED.
REPLACE ALL OCCURRENCES OF ',' IN <fs_t_itab>-fieldname WITH ''.
ENDLOOP.
‎2008 Nov 05 11:18 AM
Thanks all for your efforts.
I am using below code its working fine
while itab-xyz cs ','.
replace ',' with ' ' into itab-xyz.
endwhile.
Thanks
Basu
‎2008 Nov 05 11:30 AM
close the thread as answered if you got the solution.
Regards
Karthik D
‎2008 Nov 05 11:23 AM
Hello,
As far as my knowledge is concern, i don't think that the code has any nagation..
REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH ' '.
REPLACE ALL OCCURRENCES OF ',' IN itab-xyz WITH SPACE.