07-07-2006 8:36 AM
is there any way to find out the length of data stored in a field ? i don't want to know the length of the field .
thanx.
07-07-2006 8:37 AM
07-07-2006 8:37 AM
use function STRLEN
For eg
data: len1 type i, text (10) type c value '123'.
len1 = strlen( text ).
-Kiran
*Please reward useful answers
07-07-2006 8:39 AM
If your data is of type char then you can calculate length by using ABAP statment STRLEN.
data v_length type i.
data v_matnr type mara-matnr.
v_matnr = 'abcde'.
v_length = STRLEN( V_MATNR ).
write : v_length.
<b>Note</b>: Place ( after STRLEN,Otherwise it gives you syntax error.
07-07-2006 8:40 AM
Hi,
Here's an example:
DATA: I1 TYPE I, I2 TYPE I, I3 TYPE I,
F1 TYPE F, F2 TYPE F,
WORD1(10), WORD2(20),
XSTR TYPE XSTRING.
...
F1 = ( I1 + EXP( F2 ) ) * I2 / SIN( 3 - I3 ).
COMPUTE F1 = SQRT( SQRT( ( I1 + I2 ) * I3 ) + F2 ).
I1 = STRLEN( WORD1 ) + STRLEN( WORD2 ).
I2 = STRLEN( XSTR ).
Regards!
P.S. Please award points for useful answers.