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

validation.( urgent)

Former Member
0 Likes
939

Hi All,

My requirement is that the field must be in 5 digit format ( 5 numbers ) with no leading zeros .

Please help me with the same ..

Thanx,

Amruta.

8 REPLIES 8
Read only

Former Member
0 Likes
907

Hi,

can u b more clear with ur question.

kavitha

Read only

Former Member
0 Likes
907

move it to field of charecter type...say charfield

write field to charfield no-zero.

condense charfield no gap.

move the result back to the required field type later if required....

Regards

Vasu

Read only

Former Member
0 Likes
907

if you field is in character format....

first removing the leading zeros...

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = field1

IMPORTING

OUTPUT = field1.

null

Read only

Former Member
0 Likes
907

Hi,

declare as below, it will allow only numbers upto 5 digits.

Parameters: p_var(5) type n.

Regards,

Satish

Read only

Former Member
0 Likes
907

Hi ,

Check the String (say wf_num)l ength first with STRLEN function. If its GT then 5 the first validation is taken care of.

For Second check if wf_num CN '123456789'.

Regards

Saket Sharna

Read only

Former Member
0 Likes
907

parameters: ch(10) type c.

data: ch1(5) type c.

data: ty type DD01V-DATATYPE.

if strlen( ch ) > 5.

write: 'not perfect'.

exit.

endif.

*deleting leading zeros.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = ch

IMPORTING

OUTPUT = ch1.

CALL FUNCTION 'NUMERIC_CHECK'

EXPORTING

STRING_IN = ch1

IMPORTING

STRING_OUT = ch1

HTYPE = ty.

.

if ty = 'NUMC'.

WRITE:' perfect'.

else.

write: 'not perfect'.

endif.

Read only

gopal_jee
Product and Topic Expert
Product and Topic Expert
0 Likes
907

Hi Amruta,

For your validation you can declare a parameter of length 5.

And after the input basically you just do two checks:

1. Check for the lenght like "if strlen( parameter ) > 5 or not"

2. Check for the first character of the string like "parameter+0(1) is zero or not".

Both the conditions you can include in one IF statement with AND operator and you can validate very easily.

<b>Kindly Reward points if answer is useful.</b>

Regards,

Gopal.

Read only

former_member386202
Active Contributor
0 Likes
907

Hi,

First declare your variable type as character

then use shift statement to remove leading zeros

SHIFT <fieldname> leaft deleteing leading '0'.

Regards,

Prashant