Application Development and Automation 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: 
Read only

field length validation

Former Member
0 Likes
2,331

hi all,

i'm working on module pool, i got field called Mobile number, whose length is 10 chars.

if the user enters less then 10 chars it should give error, how to accomplish this one.

regards

suprith

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,200

Hi,

Try out this

Parameters : p_num(10) type c.

At selection-screen.

If not strlen( p_num ) EQ 10.

Message 'Please enter 10 digit number' type 'E'.

Endif.

Hope this will help you.

Please reward points if useful.

Regards

Rose

8 REPLIES 8
Read only

Former Member
0 Likes
1,200

Hi,

Read only

0 Likes
1,200

rose preeti,

please if u know the answer tell me,

Read only

Former Member
0 Likes
1,201

Hi,

Try out this

Parameters : p_num(10) type c.

At selection-screen.

If not strlen( p_num ) EQ 10.

Message 'Please enter 10 digit number' type 'E'.

Endif.

Hope this will help you.

Please reward points if useful.

Regards

Rose

Read only

0 Likes
1,200

preethi

thanks preethi, it works.

i may need some more help from u,

can u give me ur gmail ID if any doubt i'll contact u directly

Read only

0 Likes
1,200

Hi Suprith,

Sure i will try my best to help u.

Regards

Rose

Edited by: Rose Preethi on Apr 3, 2008 5:02 PM

Read only

Former Member
0 Likes
1,200

Hi,

You can use one of the following function to determine the length of the characters.

strlen

numofchar-Same as for the function strlen, except that in this case when a non-Unicode double-byte code is used, a character that occupies 2 bytes is only counted once.

You can also use Get Cursor..Length Len where Len is of type i.

Regards,

Pavithra

Read only

Former Member
0 Likes
1,200

Find the length of the filed and if its less than 10 trrow the error message also validate the filed only contains numerics.

Read only

kiran_k8
Active Contributor
0 Likes
1,200

Suprith,

data:char(40) type c.

data:v type I.

char = 'SUPRITH'.

v = strlen( char ).

write:/ 'String length is', v.

IF V > 10

give your message here.

endif.

K.Kiran.