SAP Development

Help and Information for SAP/ABAP development professionals around the world

New version of REPLACE command doesn't work with ' ' (space), well not for me!
Obsolete version "REPLACE l_char with space into l_text" works fine and you get a gap (hex-20) in the text string.
New version "REPLACE l_char in l_text with space" just removes l_char and closes the gap. I have tried all manner of variations and of data types. It's just the “space”, or ' ', that it doesn't like.

I was trying to change long-winded code to remove carriage return and line feed characters (following GET_TEXT function) with a unicode-compatible modern version. The only way I can get it to work is:
replace all occurrences of regex '[^[:print:] ]' in l_text with '¬'. "dummy to hold position of space
translate l_text using '¬ '. "then convert it to a space
condense l_text.
That does clear all non-printing characters leaving one space (hex-20) character in their place but I shouldn't need to use a dummy to hold the position and then translate to space.

What am I doing wrong?

(By the way, what is a '¬' anyway? I don't expect it in genuine text in my system so it should be safe as a dummy.)

Share

Reply to This

About

sapdev sapdev created this social network on Ning.

© 2009   Created by sapdev on Ning.   Create Your Own Social Network

Badges  |  Report an Issue  |  Privacy  |  Terms of Service