APPEND 'PROGRAM SUBPOOL.' TO code. APPEND 'FORM DYN1.' TO code. APPEND 'WRITE / ''동적인 Subroutine 1''.' TO code. APPEND 'ENDFORM.' TO code. APPEND 'FORM DYN2.' TO code. APPEND 'WRITe / ''동적인 Subroutine 2''.' TO code. APPEND 'ENDFORM.' TO code.
GENERATE SUBROUTINE POOL code NAME prog MESSAGE msg LINE lin WORD wrd OFFSET off.
IF sy-subrc <> 0. WRITE: / 'Subroutine POOL 생성에 실패하였습니다.'. ELSE. WRITE: / 'Subroutine POOL 이름 : ', prog. SKIP 2. PERFORM dyn1 IN PROGRAM (prog). SKIP 2. PERFORM dyn2 IN PROGRAM (prog). ENDIF.
서버 버젼이 맞지 않아서 에러가 나는것 같습니다.
제가 다시 해봤는데 정상적으로 되네요.
REPORT Z05_026 .
DATA: code(72) OCCURS 10,
prog(8), msg(120), lin(3), wrd(10), off(3).
APPEND 'PROGRAM SUBPOOL.'
TO code.
APPEND 'FORM DYN1.'
TO code.
APPEND
'WRITE / ''동적인 Subroutine 1''.'
TO code.
APPEND 'ENDFORM.'
TO code.
APPEND 'FORM DYN2.'
TO code.
APPEND
'WRITe / ''동적인 Subroutine 2''.'
TO code.
APPEND 'ENDFORM.'
TO code.
GENERATE SUBROUTINE POOL code NAME prog
MESSAGE msg
LINE lin
WORD wrd
OFFSET off.
IF sy-subrc <> 0.
WRITE: / 'Subroutine POOL 생성에 실패하였습니다.'.
ELSE.
WRITE: / 'Subroutine POOL 이름 : ', prog.
SKIP 2.
PERFORM dyn1 IN PROGRAM (prog).
SKIP 2.
PERFORM dyn2 IN PROGRAM (prog).
ENDIF.