06-29-2006 10:57 PM
Hi All,
I have a string which contains some non-printable characters such as tab, Carriage return/Line feed, etc, etc. How can I search for these characters in a string. I have tried to search them with SEARCH command using hex values but nothing is found. Is there a way to accomplish this? Any FM that removes all non-printable characters from the string?
Thanks in advance.
06-29-2006 11:02 PM
06-29-2006 11:02 PM
06-29-2006 11:05 PM
HI Anurag,
Use Class CL_ABAP_CHAR_UTILITIES
Method horizontal_tab
i.e, CL_ABAP_CHAR_UTILITIES=>horizontal_tab
thanks Rich for that correction ....
Regards,
Santosh
Message was edited by: Santosh Kumar P
06-29-2006 11:09 PM
06-30-2006 12:19 AM
Class CL_ABAP_CHAR_UTILITIES has these attributes:
HORIZONTAL_TAB
VERTICAL_TAB
NEWLINE
CR_LF
FORM_FEED
BACKSPACE
You can refer to any of them by prefixing 'CL_ABAP_CHAR_UTILITIES=>'.
But if you are not sure of the non-printable values you wish to eliminate maybe you can work out what IS printable and remove everything else?
eg,
first line of keyboard......
DATA first_LINE(30) VALUE
'`1234567890-=~!@#$%^&*()_+'.
DATA SECOND_LINE(30) VALUE
'qwertyuiop[]\QWERTYUIOP{}|'.
DATA THIRD_LINE(30) VALUE
'asdfghjkl;''ASDFGHJKL:"'.
DATA FOURTH_LINE(30) VALUE
'zxcvbnm,./ZXCVBNM<>?'.
data printable(150).
concatenate first_line second_line third_line fourth_line
into printable.
condense printable.
data string(120).
data hex type c.
field-symbols <hex> type x.
assign hex to <hex> casting.
*you probably don't need 'casting' in 4.6
<hex> = '09'.
concatenate first_line third_line fourth_line into string separated by hex.
write:/ string.
do.
*end when all characters are printable
if string co printable. exit. endif
string+sy-fdpos(1) = ''.
enddo.
write:/ string.
06-30-2006 12:20 AM
06-30-2006 12:27 AM
06-30-2006 12:14 AM
Thanks guys,
This class is not available to us as we are on 4.6 where as this one is availabe 4.7 and up.
Any other ideas/suggestions?
Thanks
06-30-2006 3:24 AM