‎2009 Sep 23 12:45 PM
hi
when i try to do strlen for
DATA lv_str2 TYPE string.
DATA lv_length2_str TYPE n.
lv_str2 = 'USER_AND_P' .
lv_length2 = strlen( lv_str2 ).
lv_length2_str = lv_length2.lv_length2 = 10
and when i try to do the
lv_length2_str = lv_length2 stentment i dont get any value to lv_length2_str
wahy ?
Regards
chirs
‎2009 Sep 23 12:48 PM
Hi,
type n acts like a c..you need to define leght..
DATA lv_str2 TYPE string.
DATA lv_length2_str TYPE n. "old statement
DATA lv_length2_str(3) TYPE n. "new statemnet ..pass 3 in the bracket
"or
DATA lv_length2 TYPE INT2.
lv_str2 = 'USER_AND_P' .
lv_length2 = strlen( lv_str2 ).
lv_length2_str = lv_length2.
Prabhudas
‎2009 Sep 23 12:48 PM
Hi,
type n acts like a c..you need to define leght..
DATA lv_str2 TYPE string.
DATA lv_length2_str TYPE n. "old statement
DATA lv_length2_str(3) TYPE n. "new statemnet ..pass 3 in the bracket
"or
DATA lv_length2 TYPE INT2.
lv_str2 = 'USER_AND_P' .
lv_length2 = strlen( lv_str2 ).
lv_length2_str = lv_length2.
Prabhudas
‎2009 Sep 23 1:00 PM
‎2009 Sep 23 1:03 PM
When declared as TYPE N without the length specification, it will take the default length as only one. But the length you got was 10. So it must be storing only 1. When you declared it with length as 3, its taking the whole value as 10. Thats the difference
‎2009 Sep 23 12:49 PM
Try this.
DATA lv_str2 TYPE string.
DATA lv_length2_str TYPE i.
DATA lv_length2 TYPE i.
lv_str2 = 'USER_AND_P' .
lv_length2 = strlen( lv_str2 ).
lv_length2_str = lv_length2.
write: lv_length2_str.
‎2009 Sep 23 12:53 PM
DATA lv_length2_str TYPE n.Because you have declared the type as NUMERIC of size 1, so may be while you are trying to assign the varibale then you will not get the right value.