Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP Unicode assignment question

Former Member
0 Likes
799

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,

1 ACCEPTED SOLUTION
Read only

former_member186741
Active Contributor
0 Likes
730

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.

5 REPLIES 5
Read only

former_member186741
Active Contributor
0 Likes
731

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.

Read only

0 Likes
730

Hi Neil,

thanks... how do i find the value of that unprintable character which is being shown as # in the debugger.

Thanks,

Parul

Read only

0 Likes
730

Hi Parul,

in debug put the variable in the fields area at the bottom and click the magnifying glass..this switches to hex mode.

Read only

Former Member
0 Likes
730

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>

Read only

0 Likes
730

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.