2008 Feb 13 6:37 AM
1. I have a field for pancard no which should allow you to enter "apup678n" ( alphanumeric only). It should not allow to enter the special character like $#%^&. How to validate this field?
2. I have a field called name which should allow you to enter only alphabets. How to validate this?
Thanks in advance.
Regards,
Pon Murugesh
Hi dude,
Declare the PAN No., and Name fields to type c ,
if the entered value is not of the type C,the system will automatically generate error message.
I suppose you need not carry out any validations.
Reward if useful.
Regards,
Lakshmanan
2008 Feb 13 6:46 AM
Hi,
if var cp sy-abcdef.
ur code
else.
message.
endif.
Plzz reward points if ithelps.
2008 Feb 13 6:47 AM
Pon,
DATA : v_num TYPE i,
v_cnt TYPE i.
EX: PARAMETERS : p_pancard LIKE xxxxxxx.
AT SELECTION-SCREEN.
v_num = strlen( p_pancard ).
Do v_num TIMES.
v_cnt = v_cnt + 1.
IF p_pancard+o(v_cnt) CA '$#%^&.'.
Message e000(zmp).
ENDIF.
ENDDO.
Validation For Alphabets.
EX: PARAMETERS : p_alphabets LIKE xxxxxxx.
AT SELECTION-SCREEN.
v_num = strlen( p_alphabets ).
Do v_num TIMES.
v_cnt = v_cnt + 1.
IF p_alphabets+o(v_cnt) CA '0123456789'.
Message e000(zmp).
ENDIF.
ENDDO.
Don't forget to reward if useful....
2008 Feb 13 6:49 AM
Hi,
For checking name, use sy-abcde. This will ensure only alphabets are there in the name.
Reward if Helpful.
2008 Feb 13 6:49 AM
Hi dude,
Declare the PAN No., and Name fields to type c ,
if the entered value is not of the type C,the system will automatically generate error message.
I suppose you need not carry out any validations.
Reward if useful.
Regards,
Lakshmanan
2008 Feb 13 6:52 AM
Hi Laxmanan , i think the special charachters like #*% are also considered as characters so the system will accpet that.
2008 Feb 13 7:28 AM
Hi,
For checking PAN number, please try the following.
data: pan_number(10) type c.
data: first_five_char(5) type c.
data: sixth_to_ninth(4) type c.
data: last_char(1) type c.
*for the characters of PAN card having 10 characters
*checking the first five characters to eb alphabets, the sixth to ninth as integers and the last character as an alphabet
first_five_char = pan_number+0(5).
sixth_to_ninth = pan_number+5(4).
last_char = pan_number+9(1).
*check whether the first five characters are alphabets
IF NOT ( first_five_char CO 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' ).
MESSAGE S(001). "error message
ENDIF.
IF NOT ( sixth_to_ninth CO '1234567890' ).
MESSAGE S(002). "error message.
ENDIF.
IF NOT ( last_char CO 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' ).
MESSAGE S(003). "error message
ENDIF.
Reward if Helpful.
Reward if Helpful.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |