2010 May 24 11:42 AM
Hi Experts,
I need to replace the Apostrophe in Material description with space. I am getting a error as the text literal .....longer than 255.
highly appreciated for immediate response.
REPLACE ALL OCCURRENCES OF ''' IN WA_MAKTX WITH ''.
thanks,
RRR
2010 May 24 11:45 AM
Hi Rammi,
Try like this.
REPLACE ALL OCCURRENCES OF ''' IN WA_MAKTX WITH SPACE.
Hi Experts,
I need to replace the Apostrophe in Material description with space. I am getting a error as the text literal .....longer than 255.
highly appreciated for immediate response.
REPLACE ALL OCCURRENCES OF ''' IN WA_MAKTX WITH ''.
thanks,
RRR
2010 May 24 11:45 AM
Hi Rammi,
Try like this.
REPLACE ALL OCCURRENCES OF ''' IN WA_MAKTX WITH SPACE.
2010 May 24 11:51 AM
Hi Pravin,
The problem is not with Space it is coz of the single quotes open quote '''. This is causing the problem how to overcome this.
REPLACE ALL OCCURRENCES OF ''' IN WA_MAKTX WITH SPACE.
Thanks,
rrr
2010 May 24 11:56 AM
So you simply use doubled apostrophes as to suppress its special meaning
data: str_var type string VALUE 'some text with '' and another '' '.
write: 'Before:' , str_var.
replace all OCCURRENCES OF '''' in str_var with ` `.
write: / 'After:', str_var.
Regards
Marcin
2010 May 24 12:02 PM
Hi Pciak,
I have already tried with 2 quotes of '''' syntax is fine but when i debug it is not replacing the apostrophe.
Thanks,
rrr
2010 May 24 12:11 PM
I am just curious if you tried the above? If you debug you would see that str_var contains initially two apostrophes, after the replace statement its not there anymore. I am missing something?
Regards
Marcin
2010 May 24 11:48 AM
REPLACE ALL OCCURRENCES OF ''' IN WA_MAKTX WITH ` `. "use backquotes and space character in b/w
Regards
Marcin
2010 May 24 12:19 PM
Hi,
What MARCIN had suggested will work.
Still problem persists create a text element with the value of apostrophe ie. '
eg text element TEXT-001 = ' " create the text element
REPLACE ALL OCCURRENCES OF TEXT-001 IN <YOUR STRING> WITH SPACE.
Regards,
Smart
2010 May 24 12:22 PM
Try this
replace all occurrences of `'` in lv_string with ` `.
2010 May 24 12:29 PM
Hi Rammi,
Hi have tried with the below code and I am getting the proper output as well.
DATA wa_maktx(10) TYPE c.
wa_maktx = 'as"dfg'.
REPLACE ALL OCCURRENCES OF '"' IN WA_MAKTX WITH SPACE.
write:/2 wa_maktx.
output:
asdfg
Regards,
Md Ziauddin.
2010 May 24 7:09 PM
Hi Rammi
You can try in this way
DATA: LV_STRING TYPE STRING.
DATA: REP_STRING TYPE STRING .
REP_STRING = ''''.
LV_STRING = 'some'' text '' have replace '.
DO.
SEARCH LV_STRING FOR REP_STRING.
IF SY-SUBRC = 0.
REPLACE REP_STRING WITH SPACE INTO LV_STRING.
ELSE.
EXIT.
ENDIF.
ENDDO.
Regards,
Nilay