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

field validation

Former Member
0 Likes
470

Hi,

I have table field of CHAR type.I am validating this field in my program for 'abcdefhijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.But its not working.If I remove the digits , its working fine.I guess I should have taken the field type as STRING.But now the database is not allowing me to change the field type.Please suggest how can I validate this field without changing its type in the database table.

3 REPLIES 3
Read only

Sm1tje
Active Contributor
0 Likes
452

So what are you trying to validate here and what is not working?

Read only

Former Member
0 Likes
452

Hi,

even I had faced the same problem while validating one of the field.....

then I used this statement

DATA: C_STRING(63) TYPE C
                       VALUE 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.

IF field_name CN C_STRING.

hope this works... if not please tell me how it is failing.....

Regards,

Siddarth

Read only

Former Member
0 Likes
452

Hi Sunil,

I have a code for validating values from a - z (small) and A - Z (capital).

use the same for your requirement, but dont forget to add the ASCII range from 1 to 9 also in my code..

l_partner_name = wa_input-value.

l_length = STRLEN( l_partner_name ).

l_count = 0.

DO l_length TIMES.

CALL FUNCTION 'URL_ASCII_CODE_GET'

EXPORTING

trans_char = l_partner_name+l_count(1)

IMPORTING

char_code = l_asc.

l_hex = l_asc.

l_dec = l_hex.

IF l_dec EQ 32 OR l_dec

BETWEEN 65 AND 90

OR l_dec BETWEEN 97 AND 122.

l_count = l_count + 1.

ELSE.

l_split = l_partner_name+l_count(1).

EXIT.

ENDIF.

ENDDO.

Regards,

Amit.