Skip to Content
0
Former Member
Dec 02, 2011 at 02:46 PM

CLIKE Interprets Literal Empty String as Single Character

563 Views

Hi all,

I have just discovered the CLIKE generic type and am extremely happy to have a type that will allow me to accept all character type data via a parameter, however, I am experiencing unexpected behavior with empty strings. When I declare a string, clear it, and pass it to my method, it does indeed pass as an empty string, however, when I pass a literal empty string (''), it is passed as a single character. Also, if the parameter is optional and I do not specify it at all, it is passed as a single character, whether I specify the default value as a literal empty string or do not specify a default at all. Is this really the way CLIKE is supposed to work? This is absolutely not what I would expect.

To be clear, here is some example code:

The following passes an empty string correctly when the parameter is defined as a CLIKE:

data lv_str type string.

clear lv_str.
object->method( parameter = lv_str ).

The following, however, passes a single character:

object->method( parameter = '' ).

Thanks for any insight,

-Chris