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

how to read position of field and compare----------------------

Dear friends,

actually i have one fields pan_num = AERTY2345U.

The first 5 digits(position 1-5) should consists of alpabets,the next four digits numbers(position 6-9) and the last digit (position 10) should be an alphabet.If the pan number do not comply with this formula , then it should be replaced with PANNOTAVBL.

plz help me.

thanku.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2007 at 12:58 PM

    take this as example n modify accordingly

    if v_atb(2) ne 'AT' or

    v_atb+2(1) na 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' or

    strlen( v_atb ) ne 21 or

    v_atb+11(2) not between '01' and '12' or

    v_atb+13(4) not between '2000' and '2010'.

    message w000(zv_gts) with 'Invalid ATB'(e04).

    exit.

    endif.

    tx

    kiran

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2007 at 12:47 PM

    You need compare like

    declare two variables.

    data : v_data type sy-abcde,

    v_data1 type n.

    start-of-selection.

    v_data = sy-abcde.

    v_data1 = '0123456789'.

    if urfield+0(4) co v_data.

    else.

    message.

    endif.

    if urfield+9(1) co v_data.

    else.

    message.

    endif.

    if urfield+5(4) co v_data1.

    else.

    message.

    endif.

    Reward Points if it is helpful

    Thanks

    Seshu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2007 at 12:48 PM
    If pan_num+ 0 NC 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyx'
    or pan_num+ 1
    NC 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyx'
    or pan_num+ 2
    NC 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyx'
    or pan_num+ 3
    NC 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyx'
    or pan_num+ 4
    NC 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyx'
    0r pan_num+ 5
    NC '0123456789'
    0r pan_num+ 6
    NC '0123456789'
    0r pan_num+ 7
    NC '0123456789'
    0r pan_num+ 8
    NC '0123456789'
    0r pan_num+ 9
    NC 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyx'
    
        pan_num  = 'PANNOTAVBL'.
    endif.
    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.