정의 : GRID Object를 이용하여 Report구현하기
****** data 정의 ********
INCLUDE RVREUSE_GLOBAL_DATA.
INCLUDE RVREUSE_LOCAL_DATA.
INCLUDE RVREUSE_FORMS.
DATA : PT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
*************************
****** Function 기술 *********
-- DDIC 에서 Field 정보 가져오기
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_INTERNAL_TABNAME = 'VBAP'
I_STRUCTURE_NAME = 'VBAP'
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = PT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
--- 검출한 데이타를 GRID에 Display하기
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = PT_FIELDCAT
TABLES
T_OUTTAB = i_VBAP.
---- Sample Report ------
REPORT ZVTEST.
tables : vbap.
INCLUDE RVREUSE_GLOBAL_DATA.
INCLUDE RVREUSE_LOCAL_DATA.
INCLUDE RVREUSE_FORMS.
DATA : PT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
SELECT-OPTIONS W_VBELN FOR vbap-VBELN.
data : begin of i_vbap OCCURS 0.
include structure vbap.
data : end of i_vbap.
START-OF-SELECTION.
select * from vbap INTO TABLE i_vbap
where vbeln IN W_VBELN.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_INTERNAL_TABNAME = 'VBAP'
I_STRUCTURE_NAME = 'VBAP'
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = PT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = PT_FIELDCAT
TABLES
T_OUTTAB = i_vbap.
감사합니다.