Skip to Content
author's profile photo Former Member
Former Member

Validations

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Nov 03, 2008 at 04:18 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 03, 2008 at 04:40 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 03, 2008 at 04:57 AM

    >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..?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.