05-18-2006 9:03 AM
Hi Gurus,
When i pass data from string variable to character varaible, space available in the string is missing.
lv_string contains 'Hello '. when i pass this to lv_char, iam getting 'Hello'.
is there any way by which we can pass the space as well?
Regards,
Lijo Joseph
05-18-2006 9:08 AM
Hi,
check this..
REPORT ZTEST_sring message-id zz.
data: lv_char(10).
data: str type string.
str = 'Hello '.
lv_char+0(10) = str.
write lv_char.
regards
vijay
05-18-2006 9:20 AM
Hi,
Blank characters at the end of strings are not taken into account so you get space traucated when you pass string to character field.
05-18-2006 9:40 AM
Hi Vijay,
In the code which you mention is giving length of the lv_char as 5.
it is not considering spaces...
below is the code.
***********************
data: lv_char(10).
data: str type string.
str = 'Hello '.
lv_char+0(10) = str.
lv_len = strlen( lv_char ).
write:/ 'Character Length',lv_len.
Is there any other way by which we can do this?
Regards,
Lijo Joseph
05-18-2006 12:19 PM
Hi Lijo,
if u consider the length of the string 'Hello ', even that will be returned as 5. so the char variable picks up the 5 characters..
but if u consider ' Hello'. this returns 6 characters n hence will be passed to the char variable as such with the leading space.