적당히 펑션으로 생성하셔서 사용해보세요. 기본적인 주민번호체크 루틴입니다.
*"----------------------------------------------------------------------
*"*"로컬인터페이스:
*" IMPORTING
*" VALUE(INPUT)
*" EXPORTING
*" VALUE(OUTPUT)
*"----------------------------------------------------------------------
DATA: N1 TYPE I,
N2 TYPE I,
N3 TYPE I,
N4 TYPE I,
N5 TYPE I,
N6 TYPE I,
N7 TYPE I,
N8 TYPE I,
N9 TYPE I,
N10 TYPE I,
N11 TYPE I,
N12 TYPE I,
N13 TYPE I,
LEN TYPE P,
VAL(14) TYPE C,
RESULT TYPE I.
OUTPUT = 'ERROR'.
LEN = STRLEN( INPUT ).
IF LEN <> 13 AND ( LEN <> 14 ).
EXIT.
ENDIF.
VAL = INPUT.
IF VAL+6(1) = '-'.
VAL+6 = VAL+7.
ENDIF.
IF VAL+0(1) < '0' OR ( VAL+0(1) > '9' ).
EXIT.
ENDIF.
IF VAL+1(1) < '0' OR ( VAL+1(1) > '9' ).
EXIT.
ENDIF.
IF VAL+2(1) < '0' OR ( VAL+2(1) > '9' ).
EXIT.
ENDIF.
IF VAL+3(1) < '0' OR ( VAL+3(1) > '9' ).
EXIT.
ENDIF.
IF VAL+4(1) < '0' OR ( VAL+4(1) > '9' ).
EXIT.
ENDIF.
IF VAL+5(1) < '0' OR ( VAL+5(1) > '9' ).
EXIT.
ENDIF.
IF VAL+6(1) < '0' OR ( VAL+6(1) > '9' ).
EXIT.
ENDIF.
IF VAL+7(1) < '0' OR ( VAL+7(1) > '9' ).
EXIT.
ENDIF.
IF VAL+8(1) < '0' OR ( VAL+8(1) > '9' ).
EXIT.
ENDIF.
IF VAL+9(1) < '0' OR ( VAL+9(1) > '9' ).
EXIT.
ENDIF.
IF VAL+10(1) < '0' OR ( VAL+10(1) > '9' ).
EXIT.
ENDIF.
IF VAL+11(1) < '0' OR ( VAL+11(1) > '9' ).
EXIT.
ENDIF.
IF VAL+12(1) < '0' OR ( VAL+12(1) > '9' ).
EXIT.
ENDIF.
N1 = VAL+0(1).
N2 = VAL+1(1).
N3 = VAL+2(1).
N4 = VAL+3(1).
N5 = VAL+4(1).
N6 = VAL+5(1).
N7 = VAL+6(1).
N8 = VAL+7(1).
N9 = VAL+8(1).
N10 = VAL+9(1).
N11 = VAL+10(1).
N12 = VAL+11(1).
N13 = VAL+12(1).
RESULT = N1 * 2 + N2 * 3 + N3 * 4 + N4 * 5 + N5 * 6 + N6 * 7 + N7 * 8
+ N8 * 9 + N9 * 2 + N10 * 3 + N11 * 4 + N12 * 5.
RESULT = RESULT MOD 11.
RESULT = 11 - RESULT.
RESULT = RESULT MOD 10.
IF RESULT = N13.
OUTPUT = INPUT.
ENDIF.
*"----------------------------------------------------------------------
*"*"로컬인터페이스:
*" IMPORTING
*" VALUE(INPUT)
*" EXPORTING
*" VALUE(OUTPUT)
*"----------------------------------------------------------------------
DATA: N1 TYPE I,
N2 TYPE I,
N3 TYPE I,
N4 TYPE I,
N5 TYPE I,
N6 TYPE I,
N7 TYPE I,
N8 TYPE I,
N9 TYPE I,
N10 TYPE I,
N11 TYPE I,
N12 TYPE I,
N13 TYPE I,
LEN TYPE P,
VAL(14) TYPE C,
RESULT TYPE I.
OUTPUT = 'ERROR'.
LEN = STRLEN( INPUT ).
IF LEN <> 13 AND ( LEN <> 14 ).
EXIT.
ENDIF.
VAL = INPUT.
IF VAL+6(1) = '-'.
VAL+6 = VAL+7.
ENDIF.
IF VAL+0(1) < '0' OR ( VAL+0(1) > '9' ).
EXIT.
ENDIF.
IF VAL+1(1) < '0' OR ( VAL+1(1) > '9' ).
EXIT.
ENDIF.
IF VAL+2(1) < '0' OR ( VAL+2(1) > '9' ).
EXIT.
ENDIF.
IF VAL+3(1) < '0' OR ( VAL+3(1) > '9' ).
EXIT.
ENDIF.
IF VAL+4(1) < '0' OR ( VAL+4(1) > '9' ).
EXIT.
ENDIF.
IF VAL+5(1) < '0' OR ( VAL+5(1) > '9' ).
EXIT.
ENDIF.
IF VAL+6(1) < '0' OR ( VAL+6(1) > '9' ).
EXIT.
ENDIF.
IF VAL+7(1) < '0' OR ( VAL+7(1) > '9' ).
EXIT.
ENDIF.
IF VAL+8(1) < '0' OR ( VAL+8(1) > '9' ).
EXIT.
ENDIF.
IF VAL+9(1) < '0' OR ( VAL+9(1) > '9' ).
EXIT.
ENDIF.
IF VAL+10(1) < '0' OR ( VAL+10(1) > '9' ).
EXIT.
ENDIF.
IF VAL+11(1) < '0' OR ( VAL+11(1) > '9' ).
EXIT.
ENDIF.
IF VAL+12(1) < '0' OR ( VAL+12(1) > '9' ).
EXIT.
ENDIF.
N1 = VAL+0(1).
N2 = VAL+1(1).
N3 = VAL+2(1).
N4 = VAL+3(1).
N5 = VAL+4(1).
N6 = VAL+5(1).
N7 = VAL+6(1).
N8 = VAL+7(1).
N9 = VAL+8(1).
N10 = VAL+9(1).
N11 = VAL+10(1).
N12 = VAL+11(1).
N13 = VAL+12(1).
RESULT = N1 * 2 + N2 * 3 + N3 * 4 + N4 * 5 + N5 * 6 + N6 * 7 + N7 * 8
+ N8 * 9 + N9 * 2 + N10 * 3 + N11 * 4 + N12 * 5.
RESULT = RESULT MOD 11.
RESULT = 11 - RESULT.
RESULT = RESULT MOD 10.
IF RESULT = N13.
OUTPUT = INPUT.
ENDIF.
좋은정보 고맙습니다.