0
Former Member
Jan 30, 2007 at 09:15 PM

# Problem in Validation

21 Views

I am working on a following program which validates the entered serial number.

DATA : I_EQUI LIKE EQUI.

DATA : I_SERNR LIKE EQUI-SERNR.

I_SERNR = SERNR.

SHIFT I_SERNR LEFT DELETING LEADING '0'.

• DATA : SERNR LIKE EQUI-SERNR.

• DATA : MATNR TYPE MATNR.

IF SY-TCODE = 'MB31'.

SELECT SINGLE * FROM EQUI INTO I_EQUI

WHERE EQTYP = 'S'

AND MATNR = MATNR

AND SERNR = SERNR.

IF SY-SUBRC EQ 0.

MESSAGE E398(00) WITH 'SERIAL NUMBER ALREAD EXISTS'.

ELSE.

IF SERNR0(1) = '5' OR SERNR0(1) = ''7' OR SERNR+0(1) = '9'

IF SERNR1(2) LE SY-DATUM2(2).

IF SERNR3(2) LE SY-DATUM4(2).

IF SERNR5(4) GT '0000' AND SERNR5(4) LT '9999'.

ELSE.

MESSAGE E398(00) WITH 'PLEASE ENTER RANGE WITHIN 0000 AND 9999'.

ENDIF.

ELSE.

MESSAGE E398(00) WITH 'PLEASE ENTER A DATE IN THE PAST'.

ENDIF.

ELSE.

MESSAGE E398(00) WITH 'PLEASE ENTER A DATE IN THE PAST'.

ENDIF.

ELSE.

MESSAGE E398(00) WITH 'INVALID AREA '.

ENDIF.

ENDIF.

ELSE.

SELECT SINGLE * FROM EQUI INTO I_EQUI

WHERE EQTYP = 'S'

AND MATNR = MATNR

AND SERNR = SERNR.

IF SY-SUBRC NE 0.

MESSAGE E398(00) WITH 'PLEASE ENTER A VALID SERIAL NUMBER'.

ENDIF.

ENDIF.

Even If I enter the correct first number (5,7,9) I am getting the invalid area... How can i overcome this problem..