REPORT ZDYNAMIC_ITAB_05.
TABLES : SFLIGHT.
SELECT-OPTIONS : S_CARRID FOR SFLIGHT-CARRID, "항공사
S_FLDATE FOR SFLIGHT-FLDATE. "운항일
START-OF-SELECTION.
DATA : LT_CODE(72) OCCURS 10,
L_FIELD(72) TYPE C,
L_PROG(8) TYPE C,
L_CNT(2) TYPE C,
LT_SFLIGHT LIKE SFLIGHT OCCURS 0 WITH HEADER LINE,
LS_SFLIGHT TYPE SFLIGHT.
SELECT * INTO TABLE LT_SFLIGHT
FROM SFLIGHT
WHERE CARRID IN S_CARRID
AND FLDATE IN S_FLDATE.
IF LT_SFLIGHT[] IS INITIAL.
EXIT.
ENDIF.
CLEAR : L_CNT.
SORT LT_SFLIGHT BY FLDATE.
APPEND 'PROGRAM SUBPOOL.' TO LT_CODE.
APPEND 'FORM DYN1.' TO LT_CODE.
APPEND 'DATA : BEGIN OF LT_DISP OCCURS 0,' TO LT_CODE.
APPEND ' CARRID LIKE SFLIGHT-CARRID,' TO LT_CODE.
LOOP AT LT_SFLIGHT.
ON CHANGE OF LT_SFLIGHT-FLDATE.
L_CNT = L_CNT + 1.
CONCATENATE ' FLDATE' L_CNT ' LIKE SFLIGHT-FLDATE,' INTO L_FIELD.
APPEND L_FIELD TO LT_CODE.
ENDON.
ENDLOOP.
APPEND ' END OF LT_DISP.' TO LT_CODE.
APPEND 'BREAK-POINT.' TO LT_CODE.
APPEND 'ENDFORM.' TO LT_CODE.
GENERATE SUBROUTINE POOL LT_CODE NAME L_PROG.
IF SY-SUBRC <> 0.
WRITE: / 'SUBROUTINE POOL 생성에 실패 하였습니다.'.
EXIT.
ENDIF.
PERFORM DYN1 IN PROGRAM (L_PROG).