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
470

I have field called Registratio No. in which i can enter only Numbers, '/ 'and ' *' apart from these 3 if i enter any other special characters it has to through a error message.

how to wite code for this.

I have given CHAR 16 for this field

Thanku

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
451

Hi Pranu,

You can proceed in the following way:

1. Declare are constant variable with those 3 special character.

DATA: LC_VAR TYPE STING VALUE '~!@#$%^&*()-+={}[]\|'.

2. From the Screen/UI in the PAI event, you have to write a module to check the syntax.

This is the code snippet:

if lv_value CA lc_var.

message s(messgae_no) Display like 'E'.

< Further Logic for error handling >

Endif.

You can put here any branching instruction by either call screen transaction or anything else.

Have a look at this Demo Code: DEMO_DYNPRO_FIELD_CHAIN

Hope this will help.

Samantak.

2 REPLIES 2
Read only

Former Member
0 Likes
452

Hi Pranu,

You can proceed in the following way:

1. Declare are constant variable with those 3 special character.

DATA: LC_VAR TYPE STING VALUE '~!@#$%^&*()-+={}[]\|'.

2. From the Screen/UI in the PAI event, you have to write a module to check the syntax.

This is the code snippet:

if lv_value CA lc_var.

message s(messgae_no) Display like 'E'.

< Further Logic for error handling >

Endif.

You can put here any branching instruction by either call screen transaction or anything else.

Have a look at this Demo Code: DEMO_DYNPRO_FIELD_CHAIN

Hope this will help.

Samantak.

Read only

0 Likes
451

Hi ,

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

if ZTAB2-REGNO NA lc_var1.

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

Endif.

as pre the code u have given me it is accepting only if i enter any one of the special character i specified in the local variable.

but my requirement is it should not accept if i give any other special character apart from the characters i specified in the local variable.

it should accept me if i don't enter any special character also

PLZ help me my code is