11-26-2007 10:39 AM
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.
11-26-2007 10:43 AM
11-26-2007 10:43 AM
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
11-26-2007 10:45 AM
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
11-26-2007 10:46 AM
Hi,
declare as below, it will allow only numbers upto 5 digits.
Parameters: p_var(5) type n.
Regards,
Satish
11-26-2007 10:49 AM
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
11-26-2007 10:57 AM
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.
11-26-2007 11:18 AM
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.
11-26-2007 11:23 AM
Hi,
First declare your variable type as character
then use shift statement to remove leading zeros
SHIFT <fieldname> leaft deleteing leading '0'.
Regards,
Prashant