04-23-2007 1:41 PM
Hi All,
I have got the below piece of code within an ABAP program:
FORM remove_chars_from_string CHANGING w_string.
DATA: c_dropfs(10),
fs TYPE x VALUE 13.
CONCATENATE fs ' , ' INTO c_dropfs.
TRANSLATE w_string USING c_dropfs.
ENDFORM. "remove_chars_from_string
When i select the 'Unicode checks active' checkbox the CONCATENATE statement does not syntax check as var 'fs' of type x value 13. Does anyone know what the value 13 does and how i would re-created this statement in a unicode compliant way?
Thanks in advance
Regards
Mart
04-23-2007 1:44 PM
Hi Mart,
In unicode envmnt u can use only c,n,d,t, type of data in concatenate statament.
You cannot use a hecadecimal stmnt (i.e of type X ).
what u have to do is replace X with eqivalent C,N, Type.
regards,
Navneeth.K
04-23-2007 1:47 PM
if u check Unicode check active, then u need to use only C or N type of data while concatenating.
For ur requirement u need to change the field type either to C or N and then use concatenate statement.
04-23-2007 1:47 PM
hi Mart,,
change the code to
DATA: c_dropfs(10),
fs TYPE c VALUE '#'.
hope it solves your query
regards,
Navneeth.K.
04-23-2007 1:49 PM
hi,
in additon to my earlier post the equivalent of
fs TYPE X VALUE 13 is
fs TYPE C VALUE '#'
hope it solves your problem
regards,
Navneeth.K
04-23-2007 1:50 PM
I guess first we need to figure out what the hex 13 is for. Then you could use one of the attributes of the class CL_ABAP_CHAR_UTITLIES instead of the hex field. You can concatenate the attribute like so.
data: str type string.
concatenate cl_abap_char_utilites=>horizontial_tab ',' into str.
Yes, the above example doesn't make much sence, a tab and then a comma, but you get the idea of how to concatenate a non-printable character.
The attributes of this class can be used in a concatenate statement and pass unicode checks, because they are character typed, the kernal will then translate in to the hex value behind the scenes.
Regards,
RIch Heilman
04-23-2007 1:53 PM
04-23-2007 1:55 PM
And no, the hex value 13 does not translate to #, you will see this # in debug when fewing a string, which contains non-printable characters, this # could actually be any non-printable characters, so if you were to search the string for "#", it would not find it, because it is not #, it is the non-printable character.
Regards,
RIch Heilman
04-23-2007 2:09 PM
Thanks for all the responses, but yes I appreciate that within a unicode program you can't use hex characters and ideally I would like to replace it with an attribute from CL_ABAP_CHAR_UTITLIES, but it is which one to replace it with that I need to know. Also replacing it with # for the reasons Rich Heilman pointed out will not work. Also i am not sure 13 is carriage return as the hex value for this is D or 0D (it is the ASCII value that is 13 for cr). The hex value 13 is in fact device controller 3 (DC3) but I have no idea what this means!!!! Anyone got any further ideas as to how this can be solved or what DC3 menas?
Regards
Mart
04-23-2007 2:13 PM
04-23-2007 2:16 PM
04-23-2007 2:51 PM
No problems Rich, thanks for your time and efforts on this matter.
Regards
Mart