REPORT ZDYNAMIC_ITAB_12.
TYPE-POOLS : SLIS.
DATA : G_FIELDCAT_ALV_IT TYPE SLIS_T_FIELDCAT_ALV,
G_LAYOUT_ALV TYPE SLIS_LAYOUT_ALV.
INCLUDE ZDYNAMIC_ITAB_12_TOP.
DATA : GT_SFLIGHT LIKE SFLIGHT OCCURS 0 WITH HEADER LINE,
L_CNT(2) TYPE C,
L_FIELD(72) TYPE C.
FIELD-SYMBOLS : <F1> TYPE ANY.
CLEAR : GT_SFLIGHT, L_CNT.
REFRESH : GT_SFLIGHT.
IMPORT GT_SFLIGHT FROM MEMORY ID 'TEST_ID'.
SORT GT_SFLIGHT BY FLDATE.
LOOP AT GT_SFLIGHT.
CLEAR L_FIELD.
L_CNT = L_CNT + 1.
CONCATENATE 'GT_FLDATE-FLDATE' L_CNT INTO L_FIELD.
ASSIGN (L_FIELD) TO <F1>.
<F1> = GT_SFLIGHT-PRICE.
ENDLOOP.
APPEND GT_FLDATE.
* ALV GRID 출력
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-CPROG
I_INTERNAL_TABNAME = 'GT_FLDATE'
I_INCLNAME = SY-CPROG
CHANGING
CT_FIELDCAT = G_FIELDCAT_ALV_IT.
G_LAYOUT_ALV-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = G_LAYOUT_ALV
IT_FIELDCAT = G_FIELDCAT_ALV_IT
TABLES
T_OUTTAB = GT_FLDATE.