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: 

Excluding special characters.

Former Member
0 Kudos

hi,

i want to validating some fields and i want only alphabets to be entered.. it can be in lower case or upper case,

but no special characters and numerics..

wot can be done?

4 REPLIES 4

Former Member
0 Kudos

Hi Sneha,

You could use the "regular expressions" technique for this, but it depends on the version you are on.

Regards,

John.

Former Member
0 Kudos

Hi Sneha,

When you will execute this code and you will put anything in parameter on selection screen you will get only alphabets.

REPORT z_test.

PARAMETERS: p_text(80) TYPE c DEFAULT 'R~a!m?m@o#h$a%n?4^5&j*A(G)A}N'.

DATA: w_text(80) TYPE c VALUE

'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.

DATA: w_len TYPE i,

w_off TYPE i.

w_len = STRLEN( p_text ).

DO w_len TIMES.

w_off = sy-index - 1.

IF w_text CS p_text+w_off(1).

ELSE.

p_text+w_off(1) = space.

ENDIF.

ENDDO.

CONDENSE p_text NO-GAPS.

WRITE : p_text.

Former Member
0 Kudos

Hi,

You can check by sy-abcde and numbers.., if anything other than these is a special character.

if v_text na sy-abcde.

if v_text na '0123456789 '.

message i000 with 'invalid text'.

endif.

endif.

Regards

Sailaja.

Former Member
0 Kudos

simply you can use this.

sy-abcde.

if val ca sy-abcde.

ok

else .

worng value in val.

endif.

Vijay