2009 Mar 16 8:41 AM
Hi Friends,
I have a field (CHAR TYPE) value as 200,000,000.00000
I want to replace the ',' with '.'
I tried with REPLACE statement. But it replaces only the first occurrence.
How to do this?
The expected output is 200.000.000.00000
Regards,
Viji
2009 Mar 16 8:43 AM
Hi,
Try with REPLACE ALL OCCURRENCE
Hope this helps you.
Regards,
Tarun
2009 Mar 16 8:44 AM
2009 Mar 16 9:08 AM
Hi,
Use code, its working:
DATA : v_str(20) TYPE c VALUE '200,000,000,000.000'.
DATA : v_c_str(20) TYPE c.
DATA itab TYPE TABLE OF string WITH HEADER LINE.
START-OF-SELECTION.
SPLIT v_str AT ',' INTO TABLE itab.
LOOP AT itab.
IF v_c_str IS INITIAL.
v_c_str = itab.
ELSE.
CONCATENATE v_c_str '.' itab INTO v_c_str.
ENDIF.
ENDLOOP.
END-OF-SELECTION.
WRITE : v_c_str.
Hope this helps you.
Regards,
Tarun
2009 Mar 16 8:43 AM
2009 Mar 16 8:44 AM
2009 Mar 16 8:46 AM
2009 Mar 16 9:48 AM
>
> I am working in 4.6C
So isn't replace all occurances of statement available to you?
then u can try like this
do.
use ur replace statement here then check sy subrc.
if sy-subrc ne 0.
exit.
endif.
enddo.
кu03B1ятu03B9к
2009 Mar 16 8:44 AM
Hi,
Do as below:
DATA : v_char TYPE char30 VALUE '200,000,000.00000'.
REPLACE ALL OCCURRENCES OF ',' in v_char WITH '.'.
WRITE : v_char.
Regards.
2009 Mar 16 8:45 AM
Hi,
please check this code
data : wa type CEPC_BUKRS,
itab type table of CEPC_BUKRS.
loop at itab into wa.
case wa-bukrs.
when 'PTUS' or 'HQUS' or 'CTCA'.
replace all occurences of '-' in wa with '.'.
modify itab from wa index sy-tabix.
endcase.
endloop.Thanks and regards
Durga.K
2009 Mar 16 8:46 AM
2009 Mar 16 8:45 AM
Hi,
Write 'REPLACE ALL OCCURENCE' statement
Regards,
Jyothi CH.
2009 Mar 16 8:47 AM
you can try this,
REPLACE ALL OCCURRENCES OF ',' IN field1 WITH '.'
Regards,
Joan
2009 Mar 16 8:47 AM
Have you tried the REPLACE .....ALL OCCURRENCES OF option?
Which SAP version are you using?
Another option you have is Overlay < var> with '.................' only ','.
Mathews.
2009 Mar 16 9:04 AM
Hi There,
data: lv_num(20) type c ,
lv_num1(10) type c,
lv_num2(10) type c,
lv_num3(10) type c.
if lv_num ca ','.
split lv_num at ',' into lv_num1 lv_num2 lv_num3.
concatenate lv_num1 lv_num2 lv_num3 into lv_num seperated by '.'.
Edited by: BrightSide on Mar 16, 2009 9:04 AM
2009 Mar 16 9:31 AM
Hi,
data: num(20) type c value '200,000,000.00000',
num1(10) type c,
num2(10) type c,
num3(10) type c.
split num at ',' into num1 num2 num3.
concatenate num1 '.' num2 '.' num3 into num.
Hope this might help you out.
Pooja
2009 Mar 16 10:09 AM
hey
Defenitely working.
DATA lv_char(20) TYPE c .
DATA lv_num(10) TYPE c.
lv_char = '200,000,000.000'.
DO.
IF lv_char CA ','.
REPLACE ',' WITH '.' INTO lv_char.
else.
EXIT.
endif.
ENDDO.
write: lv_char.
regardz
2009 Jul 27 10:30 AM