Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

length of field value

sushant_singh
Participant
0 Kudos

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.

4 REPLIES 4

dani_mn
Active Contributor
0 Kudos

Hi,

len = STRLEN (field).

Regards,

Wasim Ahmed

Former Member
0 Kudos

use function STRLEN

For eg

data: len1 type i, text (10) type c value '123'.

len1 = strlen( text ).

-Kiran

*Please reward useful answers

0 Kudos

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.

aris_hidalgo
Contributor
0 Kudos

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.