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: 

counting the number of digits in a field

Former Member
0 Kudos

Hello friends,

does anyone know of any function module by which we can count the number of digits in a field.

Say i have a priority field which is numc2, and the the user fills in a 5 digit number in it, i was to calculate this and raise an error if the number of digits is more than 2.

Thanks in advance.

charu.

2 REPLIES 2

naimesh_patel
Active Contributor
0 Kudos

Yes you can use the STRLEN syntax.

DATA: L_LEN TYPE I.

L_LEN = STRLEN( L_VAR ).

Regards,

Naimesh Patel

Former Member
0 Kudos

data : text(10),

len type i.

text = <your variable which user is passing>

len = strlen( text ).

if len gt 2.

message 'Length incresed' type 'E'.

endif.

regards

shiba dutta