cancel
Showing results for 
Search instead for 
Did you mean: 

To find stringlength of a variable

Former Member
0 Kudos

Hi,

I have to print customer PO numbers in the o/p of a smartform.When I checked in the print preview of the smartform,some numbers are getting truncated.This is because it is printing only upto 255 characters.The rest of the values getting truncated.

So I want to find the string length of the variable into which these values are getting populated.If the length is less than 255 characters,I want to include one type of logic or if the length is greater than 255 characters i want to include other type of logic.

Can anyone tell me how to find the string length of a variable?

Regards,

Hema

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi,

PARAMETERS: P_STR(30) TYPE C.

DATA: W_LEN TYPE I.

W_LEN = STRLEN( P_STR ). " Space after ( and before )

Regards,

Satish

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

data : w_len type i.

w_len = strlen( w_field ).

to have the lenght of the content of w_field.

Regards,

Raj.

Former Member
0 Kudos

Hi,

Hema

Declare a variable length type i in Global Defination

length = strlen(u r Variable )

Length field will calculate the string length.

with Regards,

Kiran.G

Former Member
0 Kudos

Hi,

It is giving error as 'field STRLEN is unknown,it is neither in one of the specified tables,nor defined by the data statement'.

Regards,

Hema

Former Member
0 Kudos

Hi,

Hema

Length = STRLEN ( value ).

after strlen open bracket and one space then u r field and space close Bracket.

with Regards,

Kiran.Gouni

asik_shameem
Active Contributor
0 Kudos

Hi

Give a space after ( and before ). like strlen( text ).