‎2006 May 11 7:12 AM
I want to replace # characters in a string with space.
I hav a 472 unicode enabled system.
Single field <keydata>+66
Field contents ####### 0000201040 WI 01 000001
Type C
Length 31
Output length 31
Decimal places 0
these # characters have to be cleaned out in this string.
I tried REPLACE ALL OCCURRENCES OF '#' IN <keydata>+66(*) WITH space. without any success.
I tried this code snippet also without any success.
data: t1 type i value 66,
t2 type i value 1,
c_hash type x value '#'.
field-symbols : <fs> type any .
assign <keydata>+t1(1) to <fs> casting type x.
while ( <fs> eq c_hash ).
<keydata>+t1(1) = space.
t1 = t1 + 1.
assign <keydata>+t1(1) to <fs> casting type x.
endwhile.
<keydata>+t1(1) = space.
Please suggest what could be the solution.
Thanks,
‎2006 May 11 7:17 AM
i THINK THE PROBLEM HERE IS THAT WHAT YOU ARE SEEING AS '#' IS NOT ACTAULLY THAT. iT IS AN UNPRINATBLE CHARACTER WHICH IS REPRESENTED AS THAT. TRY TO FIND OUT WHAT THE VALUE IS....OFTEN IT'S TAB WHICH I THINK IS X'09'. Maybe try using CL_ABAP_CHAR_UTILITIES==>horizontal_tab.
‎2006 May 11 7:17 AM
i THINK THE PROBLEM HERE IS THAT WHAT YOU ARE SEEING AS '#' IS NOT ACTAULLY THAT. iT IS AN UNPRINATBLE CHARACTER WHICH IS REPRESENTED AS THAT. TRY TO FIND OUT WHAT THE VALUE IS....OFTEN IT'S TAB WHICH I THINK IS X'09'. Maybe try using CL_ABAP_CHAR_UTILITIES==>horizontal_tab.
‎2006 May 11 7:20 AM
Hi Neil,
thanks... how do i find the value of that unprintable character which is being shown as # in the debugger.
Thanks,
Parul
‎2006 May 11 7:24 AM
Hi Parul,
in debug put the variable in the fields area at the bottom and click the magnifying glass..this switches to hex mode.
‎2006 May 11 7:27 AM
Hi parul,
Does the string contain english work or some foreign language..
how r u populating it..
Some foriegn words which cant be recognised are represented as '#'.
Regards,
Tanveer.
<b>Please mark helpful answers</b>
‎2006 May 11 7:38 AM
Hi Niel, Tanveer,
I used this code. it seems to be working
Thanks a lot,
Parul
data: t1 type i value 66,
t2 type i value 1,
c_hash type x. "the offending char is X'00'
field-symbols : <fs> type any .
assign <keydata>+t1(1) to <fs> casting type x.
while ( <fs> eq c_hash ).
<keydata>+t1(1) = space.
t1 = t1 + 1.
assign <keydata>+t1(1) to <fs> casting type x.
endwhile.
<keydata>+t1(1) = space.