cancel
Showing results for 
Search instead for 
Did you mean: 

How to find length of a character variable in sap script

Former Member
0 Kudos

Hi,

I have stored a line of text in one variable. If the text exceeds more than 50 characters, the remaining characters will be printed in next line.

For this i have given code as :

<I>&S_BOL_SUMMARY-TXT(50)&</>

<I>&S_BOL_SUMMARY-TXT+50&</>

The problem is i have to print the second line only when the text exceeds more than 50 characters. So how can i give the condition for that?

Ezhil

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try the following,



data: len type i.
len = strlen (S_BOL_SUMMARY-TXT ).

if len > 50.
&S_BOL_SUMMARY-TXT(50)&
&S_BOL_SUMMARY-TXT+50&
else.
&S_BOL_SUMMARY-TXT(50)&
endif.