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: 

leng of str

Former Member
0 Kudos

hi,

i wont to find the length of string how couled i do that?

regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi ricardo

plz try this:


  DATA:  w_len TYPE i.

   w_len = STRLEN( v_pattern2 ).

Regards

Shimit

11 REPLIES 11

Former Member
0 Kudos

Hi,

Use STRLEN() function.

e.g

data: l_length type i,

str type strings.

l_length = strlen( str ).

Former Member
0 Kudos

use strlen to get the string length ..

Former Member
0 Kudos

hi ricardo

plz try this:


  DATA:  w_len TYPE i.

   w_len = STRLEN( v_pattern2 ).

Regards

Shimit

Former Member
0 Kudos

DATA : len TYPE i
DATA : str TYPE CHAR10 value 'ABACD'.

len = strlen( str ).

WRITE 😕 len.


Former Member
0 Kudos

Hi

STRLEN( ).

Finding the Length of a Character String

The ABAP function STRLEN returns the length of a string up to the last character that is not a space.

[COMPUTE] <n> = STRLEN( <c> ).

STRLEN processes any operand <c> as a character data type, regardless of its real type. There is no type conversion.

As with mathematical functions, the keyword COMPUTE is optional.

Example:

DATA: INT TYPE I,

WORD1(20) VALUE '12345'.

WORD2(20).

WORD3(20) VALUE ' 4 '.

INT = STRLEN( WORD1 ). WRITE INT.

INT = STRLEN( WORD2 ). WRITE / INT.

INT = STRLEN( WORD3 ). WRITE / INT.

The results are 5 , 0, and 4 respectively.

Regards

Pavan

Former Member
0 Kudos

Use below statement.

l = STRLEN (string name).

Regards,

Atish

jj
Active Contributor
0 Kudos

use

LEN = STRLEN( variable to find string length).

in len variable we will get the string length

Former Member
0 Kudos

data : name type string,

l_length type i.

i_length = strlen (name).

thanks and regards

vennila.

Former Member
0 Kudos

Try using XSTRLEN function...

Rewards if useful...

Rgds,

Vijay

Former Member
0 Kudos

Hi,

DATA:

W_STRING1 TYPE STRING,

W_LENGTH TYPE I.

W_STRING = 'ABCDEFGHIJKL'.

W_LENGTH = STRLEN( W_STRING ).

WRITE:

/ 'Length of the string is ', W_LENGTH.

Regards,

Rama.Pammi

Former Member
0 Kudos

Hi,

Copy this code and you will get the solution.

Data: a(50) value 'PQRPQRPQRXYZ',

b type i.

b = strlen( a ).

write:/ b.

Reward if helpful.

Regards,

Harini.S