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: 

validation.( urgent)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

can u b more clear with ur question.

kavitha

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

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

Parameters: p_var(5) type n.

Regards,

Satish

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

gopal_jee
Explorer
0 Kudos

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.

former_member386202
Active Contributor
0 Kudos

Hi,

First declare your variable type as character

then use shift statement to remove leading zeros

SHIFT <fieldname> leaft deleteing leading '0'.

Regards,

Prashant