2009 Mar 15 3:26 PM
Hi,
Note : I am using SAP 4.6
Task : Replace Comma with space
Problem : Not able to replace comma with space
I have task where I have to write result file to application server, when I am writing string to application server it is separating by comma, for example if you take below statement it is dividing by space that means in first column PO and then ITEM etcu2026.
MOVE 'PO ITEM is not there in table EKPO' TO W_RECORD_OUT-ERROR_MSG.
so to resolve this situation I have used below code for now, I know I can use
REPLACE ... ALL ENTRIES but this statement is not working in SAP 4.6
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
CONDENSE W_RECORD_OUT-ERROR_MSG.
appreciate if somebody can help me.
Thanks
sarath
2009 Mar 15 4:28 PM
Hi,
just see the code below if you feel that its fine then you can proceed with it...
REPLACE ',' WITH space INTO W_RECORD_OUT-ERROR_MSG.
" Replaced with the keyword spaceRegards,
Siddarth
2009 Mar 15 3:33 PM
You can try :
Overlay <variable> with <spaces based on length> ONLY ','.
Mathews
2009 Mar 15 3:54 PM
if w_record_out-error_msg ca ','.
split w_record_out-error_msg at ',' into lv_string1
lv_string2
contatenate lv_string1 lv_string2 seperated by space.
endif.
2009 Mar 15 4:09 PM
Ur replace statment is fine just dont use ' ' instead use ` ` ( the quotes beside number 1 on top left).
Then it will work fine.
кu03B1ятu03B9к
2009 Mar 15 4:28 PM
Hi,
just see the code below if you feel that its fine then you can proceed with it...
REPLACE ',' WITH space INTO W_RECORD_OUT-ERROR_MSG.
" Replaced with the keyword spaceRegards,
Siddarth
2009 Mar 16 2:53 AM
Hi,
replace all occurrences of ','
in <field> with space .
Thanks,
Krishna
2009 Mar 16 3:18 AM
2009 Mar 16 3:20 AM
Hi,
Please check the below code.
REPORT YSAT_TEST.
Data: Var1(40) type c value 'Test1,Test2,Test3,Test4'.
break-point.
REPLACE ',' WITH space INTO Var1. " It will replace only first occurrence
replace all occurrences of ',' in var1 with ' '.
CONDENSE Var1 no-gaps.
write: var1.