‎2010 Oct 05 2:44 PM
hi,
i have a character-field containing
"18.08.2003: Typenschein; Typenscheintausch; Rechnung Autohaus Brunner"
Now i want to replace all the ; with ,
I have done:
REPLACE ALL OCCURRENCES OF ';' IN satz-text WITH ','.
The result now is:
"18.08.2003: Typenschein, Typenscheintausch; Rechnung Autohaus Brunner"
WHY only the FIRST ; is replaced and not the second ????????????????????
reg, Martin
‎2010 Oct 05 2:51 PM
No idea why it doesn't work unless the second ';' is not really a ';'.
But try it with :
translate satz-text using ';,'.
‎2010 Oct 05 2:52 PM
Hi Martin,
DATA : CHAR(300) TYPE c VALUE '18.08.2003: Typenschein; Typenscheintausch; Rechnung Autohaus Brunner'.
REPLACE ALL OCCURRENCES OF ';' in char with ','.
write: / char.
The output I get is
18.08.2003: Typenschein, Typenscheintausch, Rechnung Autohaus Brunner
Which is correct.
Check the declaration for the field you have provided for satz-text
Sujay
‎2010 Oct 05 2:58 PM
coding looks like this. satz is a internal table:
DATA: BEGIN OF satz OCCURS 0, "Ausgabestruktur
krednr(8) TYPE n, "Kreditaktennummer
doktyp(2) TYPE c,
ardate TYPE d,
pfad(100) TYPE c,
text(150) TYPE c,
url(200) TYPE c, "URL für Verbindung
END OF satz.
.
.
.
.
LOOP AT satz.
REPLACE ALL OCCURRENCES OF ';' IN satz-text WITH ','. "01a
‎2010 Oct 05 3:07 PM
Hi ,
i tried this it is working fine ..
My Code
-
DATA : lv_char TYPE char300.
lv_char = '18.08.2003: Typenschein; Typenscheintausch; Rechnung; Autohaus; Brunner'.
WRITE : lv_char.
REPLACE ALL OCCURRENCES OF ';' IN lv_char WITH ','.
WRITE : lv_char.
-
and Result is
18.08.2003: Typenschein; Typenscheintausch; Rechnung; Autohaus; Brunner
18.08.2003: Typenschein, Typenscheintausch, Rechnung, Autohaus, Brunner
Regards
JK
‎2010 Oct 05 3:23 PM
Just maybe the entire text is not within satz-text field.
I dont see any reason why this wouldn't work.
‎2010 Oct 05 4:29 PM
Hi,
probably you did not modify your itab correctly.
Try
fields-symbols:
<satz> like satz.
LOOP AT satz assigning <satz>.
REPLACE ALL OCCURRENCES OF ';' IN <satz>-text WITH ','.
This is still far from state of the art (internal tables with header line declared wit OCCURS are obsolete) but use of a field-symbol will speed up the process.
Regards,
Clemens
‎2010 Oct 05 3:23 PM
Hi,
I tried it & it is working fine, so no idea why it is not working at your end.
If you do not have any other option then try this :
Split the string at ; into 3 variables and then concatenate it seperated by ,.
This should work.
Rgds,
Sameer
‎2010 Oct 05 3:53 PM
guys,
thanks for your help but i stil don't get it.
i have tried it with 'normal' declaration of the char-field.
COULD it be the problem that the field is part of the structure of the internal table and not an 'standalone-field' ?
reg, Maritn
DATA: BEGIN OF satz occurs 0, "Ausgabestruktur
krednr(8) TYPE n, "Kreditaktennummer
doktyp(2) type c,
ardate type d,
pfad(100) TYPE c,
text(150) TYPE c,
url(200) TYPE c,
‎2010 Oct 05 5:11 PM
‎2010 Oct 05 5:22 PM
Was suggested already, please read the replies before posting.
REPLACE ALL OCCURRENCES does work as well under normal circumstances, there might be some goofy code page problem or whatever, I assume the information presented here so far does not allow finding the root cause.
Thomas
‎2010 Oct 05 5:35 PM
Hi,
Just a guess!!
If you have copy pasted the below text from some other editor, maybe the semicolon is not recognised by abap editor. Try deleting this message and type in again in your editor and check if it works. This happens sometimes with apostrophe.
"18.08.2003: Typenschein; Typenscheintausch; Rechnung Autohaus Brunner"
Regds,
Senthil