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

Replace command is not running.

rogerio_vazdesouza2
Participant
0 Likes
1,084

Hi Gurus,

I am running a function module, where the program is not running replace command,


it simply passes through the line of code but does not replace the value.




replace all occurrences of  '#'  in  ex_w_budg_doc_in-orc-km               with '0'.


Can you help me.


Thanks.

7 REPLIES 7
Read only

Former Member
0 Likes
1,034

Are you sure there is a "#" in your value?

The character "#" is also used as a replacement character for non printable characters (like LINEFEED, TABSTOP, etc.).

Where are you looking at your value? Debugger text view? What you see there might not be equal to what is actually there, because you cannot see non printable characters. Instead of them you see the character "#".

Read only

0 Likes
1,034

Hi Andre,


the program executes and ends with dump. In debug mode

the value displayed is the character '#' but it seems that

the hexadecimal value is another.

Read only

0 Likes
1,034

Hi

Where are your string from?

I mean you need to investigate about your source in order to understand what # really is, you can find main (not printable) chararter in class CL_ABAP_CHAR_UTILITIES

Max

Read only

0 Likes
1,034

And as I call the class within the program, moving ex_w_budg_doc_in-orc-km ?


I tried to model but failed.


Can you show me?


Thanks !

Read only

0 Likes
1,034

Just check what UTF-16 character your hexadecimal value refers to.

Read only

0 Likes
1,034

Hi Andre,

I can identify with the condition IF NOT CO '0123456789',


but I can not replace the special character with '0'.

Read only

0 Likes
1,034

If you have a Unicode System, you can do the following.

You can look at the hexadecimal value in debugger.

Take the hexadecimal value of your non printable character from there.

With this value you look at the unicode table (use Google for it). And you will get the exact character that this hex value represents.

Please not that your system codepage is always UTF-16 but has a specific byte order (BE or LE) depending on your plattform.

So maybe you have to swap the bytes before looking into the unicode table.