2006 Nov 30 6:22 AM
I m having a field projectname type c of length 50.
I should not allow the user to enter the project name which contain special character.
i tried with CO with sy-abcde its not working correctly since i have used length 50.
if i want to use sy-abcde means the string must grow dynamically, but here project name is a keyfield so i m not able to use string type .
Can any one help me to solve it.
Thanks in advance.
Kalpanashri Rajendran.
2006 Nov 30 6:25 AM
hi,
pls try this.
if l_string CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
write : 'String has a character'.
endif.
<b>please refer this thread.
https://forums.sdn.sap.com/click.jspa?searchID=234253&messageID=2685281</b>;
rgds
Anver
2006 Nov 30 6:25 AM
hi,
pls try this.
if l_string CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
write : 'String has a character'.
endif.
<b>please refer this thread.
https://forums.sdn.sap.com/click.jspa?searchID=234253&messageID=2685281</b>;
rgds
Anver
2006 Nov 30 6:26 AM
Hi,
I think sy-abcde should work.
Try the following -
parameters p_proj(50).
data lv_ptoject(50) type c.
at selection-screen.
lv_project = p_proj.
condense lv_project no-gaps.
if not lv_project CO sy-abcde.
"Error Message"
endif.
Hope that helps.
Regards,
Anand Mandalika.
2006 Nov 30 6:26 AM
2006 Nov 30 6:27 AM
Hi,
data : alphanumeric(38).
parameters fname(4).
AT SELECTION-SCREEN ON fname.
IF fname CA '0123456789' and fname ca sy-abcde.
message e000(zhrt) with 'alphanumeric'.
elseif fname ca '0123456789'.
message e000(zhrt) with 'no'.
elseif fname ca sy-abcde.
message e000(zhrt) with 'alphabet'.
ENDIF.
2006 Nov 30 6:29 AM
Hi Rajendran,
I hope the following code will helps to you.
If you want check with special character group.
[code]DATA:
c_schar_grp TYPE char50 VALUE '~`!@#$%^&*()_+=-{[}]"':;?/>. <,', " Special character set
IF plv_projname CN c_schar_grp.
Message 'Error Please avoid Special character' TYPE 'E'.
ENDIF.[/code]
If you want check with character group.
[code]DATA:
c_alphanumc TYPE char69
VALUE 'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'. " Alphanumc Group
IF plv_projname CO c_alphanumc.
--- define your code here.
ELSE.
--- Raise error
ENDIF.[/code]
Regards
Bhupal Reddy
Message was edited by:
Bhupal Reddy Vendidandi
Message was edited by:
Bhupal Reddy Vendidandi
2006 Nov 30 6:47 AM
Hi
I have tested it. It's working fine. Check it out.
PARAMETERS P_PROJECT(50).
DATA V_PROJECT TYPE STRING.
AT SELECTION-SCREEN OUTPUT.
V_PROJECT = p_PROJECT.
CONDENSE V_PROJECT NO-GAPS.
IF NOT V_PROJECT CO sy-abcde.
MESSAGE 'Wrong Input' TYPE 'E'.
ENDIF.
--> You will get error message when you give input with special character
Regards
Surya.