Application Development and Automation 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: 
Read only

Validations

Former Member
0 Likes
503

My code is:

DATA: V_VAR1 TYPE STRING VALUE ' -*/'.

if ZTAB2-REGNO NA V_VAR1.

message E010(ZMSG) with 'Enter Valid Registration Number'.

Endif.

my requirement is in registration Number field it it should accept only numeric,Characters,and the special characters i specified in the local variable.

As per my code it is accepting if i give any of the special characters with one among the above.

PLZ help me

Thanks in Advance

1 ACCEPTED SOLUTION
Read only

raja_narayanan2
Active Participant
0 Likes
479

Hi........

Try this code.....

parameter p_name type string.

DATA: LEN TYPE I,

T TYPE I VALUE 0,

GV_CHAR,

SPCHAR(35) TYPE C VALUE '~`!@#$%^&*()_-+={[}]|\:;"''<,>.?/',

INP(50) TYPE C.

CONDENSE p_name.

LEN = STRLEN( p_name ).

DO LEN TIMES.

MOVE p_name+T(1) TO GV_CHAR.

IF GV_CHAR CA SPCHAR.

move p_namet(1) to inpt(1).

concatenate 'Special Characters are not allowed:' inp into inp.

*<Your error message here>

ENDIF.

T = T + 1.

ENDDO.

Hope this will help you.

Thanks & Regards

Raja.

3 REPLIES 3
Read only

raja_narayanan2
Active Participant
0 Likes
480

Hi........

Try this code.....

parameter p_name type string.

DATA: LEN TYPE I,

T TYPE I VALUE 0,

GV_CHAR,

SPCHAR(35) TYPE C VALUE '~`!@#$%^&*()_-+={[}]|\:;"''<,>.?/',

INP(50) TYPE C.

CONDENSE p_name.

LEN = STRLEN( p_name ).

DO LEN TIMES.

MOVE p_name+T(1) TO GV_CHAR.

IF GV_CHAR CA SPCHAR.

move p_namet(1) to inpt(1).

concatenate 'Special Characters are not allowed:' inp into inp.

*<Your error message here>

ENDIF.

T = T + 1.

ENDDO.

Hope this will help you.

Thanks & Regards

Raja.

Read only

prasanth_kasturi
Active Contributor
0 Likes
479

Hi,

Try this manner

.

Use CO( contains only ) relational opertaor



DATA: V_VAR1 TYPE STRING VALUE ' -*/'.

if ZTAB2-REGNO CO V_VAR1.

else.

message E010(ZMSG) with 'Enter Valid Registration Number'.

Endif

regards

prasanth

Read only

Former Member
0 Likes
479

>my requirement is in registration Number field it it should accept only numeric,Characters,and the special characters i specified in the local variable.

what should it accept, and what not..?