2011 Nov 10 12:44 PM
Hi All,
I have a variable with text lv_longtext = ' Invoices must be against##Honeywell SA##Succursale du Luxembou ' and i am replacing the duble hashes with below code. after that we are trying to move this text to excel file but the output is coming as
Invoices must be against Honeywell SA Succursale du Luxembou. Please help us to remove the special character  FROM THE TEXT. if we check in debug mode we are able to see the space insted of special character  but after downloaded into the excle we are getting this special character.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN lv_longtext WITH
' '. ALT 255 ASCII Character is used for space
Used below fm to display into output.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
Thanks,
Venkat
2011 Nov 10 12:55 PM
Hi,
Try;
REPLACE ALL OCCURRENCES OF '##' IN lv_longtext WITH space.
instead of
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN lv_longtext WITH
' '.
Çağatay
2011 Nov 10 12:59 PM
Hi,,
HASHSES are Entered characters of the long text which is there at purchase order level.
In purchase order they have maintained text like
Invoices must be against
Honeywell SA
Succursale du Luxembou
IF we use read_text fm to get this text we will get DUBLE HASES and that we can't remove using some space..
2011 Nov 10 2:08 PM
Did you try to convert the text to a stream using FM CONVERT_ITF_TO_STREAM_TEXT ? Maybe that will work for you in this case.
2011 Nov 10 2:14 PM
Hi,
try to use below coding,
DATA:
c_recdel(1) type c value '~',
c_recdelx TYPE x VALUE '7E', " ~ in hex
c_segdel(1) type c value '^',
c_segdelx type x value '5E', " ^ in hex
c_space(1) type c value ' ',
c_spacex TYPE x VALUE '20'. " Space in hex
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = l_string
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = l_xstring.
* replace the special characters with a space.
replace all occurrences of c_recdelx in l_xstring
with c_spacex in byte mode.
* replace the special characters with a space.
replace all occurrences of c_segdelx in l_xstring
with c_spacex in byte mode.
*replace for other special characters....
* Convert row back to character string.
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = l_xstring
im_encoding = 'UTF-8'
IMPORTING
ex_string = l_string.
i_final_line = l_string.
Thanks,
Chandra
2011 Nov 10 3:36 PM
is often used to represent an unprintable character...How do you know the problem is CRLF? It is very likely something else...in debug, find out what those characters actually are (debug shows the hex value!). Then, if you have something odd, turn off unicode in program attributes, declare data type x with the value of the hex for the bad character, and search for that and replace it with space or whatever is needed.
Your problem could be any hex values below 20 and any hex values above 7E