*&---------------------------------------------------------------------*
*& Report ZGDEMO_ALV_BLOCK_LIST_7AM
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_ALV_BLOCK_LIST_7AM.
INCLUDE ZGDEMO_ALV_TOP_7AM.
START-OF-SELECTION.
*READ DATA
PERFORM READ_DATA.
END-OF-SELECTION.
*INITIALIZE ALV BLOCK
PERFORM INITIALIZE_ALV_BLOCK.
*APPEND THE DATA TO BE DISPLAYED
PERFORM APPEND_DATA_TO_BLOCK.
*DISPLAY ALV BLOCK
PERFORM DISPLAY_ALV_BLOCK.
*&---------------------------------------------------------------------*
*& Form INITIALIZE_ALV_BLOCK
*&---------------------------------------------------------------------*
FORM INITIALIZE_ALV_BLOCK .
call function 'REUSE_ALV_BLOCK_LIST_INIT'
exporting
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
.
ENDFORM. " INITIALIZE_ALV_BLOCK
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_BLOCK
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV_BLOCK .
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* IS_PRINT =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " DISPLAY_ALV_BLOCK
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_TO_BLOCK
*&---------------------------------------------------------------------*
FORM APPEND_DATA_TO_BLOCK .
*BUILD FIELDCATALOG
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_T001'
I_STRUCTURE_NAME = 'T001'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
changing
CT_FIELDCAT = IT_FIELDCATALOG
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*APPEND IT_T001
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG
I_TABNAME = 'IT_T001'
IT_EVENTS = IT_EVENTS
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_T001
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*2ND ITAB TO BE DISPLAYED
REFRESH IT_FIELDCATALOG.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_KNB1'
I_STRUCTURE_NAME = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
changing
CT_FIELDCAT = IT_FIELDCATALOG
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*APPEND IT_T001
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG
I_TABNAME = 'IT_KNB1'
IT_EVENTS = IT_EVENTS
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_KNB1
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " APPEND_DATA_TO_BLOCK
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT * INTO TABLE : IT_T001 FROM T001 UP TO 15 ROWS,
IT_KNB1 FROM KNB1 FOR ALL ENTRIES IN
IT_T001
WHERE BUKRS = IT_T001-BUKRS.
ENDFORM. " READ_DATA
*& Report ZGDEMO_ALV_BLOCK_LIST_7AM
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_ALV_BLOCK_LIST_7AM.
INCLUDE ZGDEMO_ALV_TOP_7AM.
START-OF-SELECTION.
*READ DATA
PERFORM READ_DATA.
END-OF-SELECTION.
*INITIALIZE ALV BLOCK
PERFORM INITIALIZE_ALV_BLOCK.
*APPEND THE DATA TO BE DISPLAYED
PERFORM APPEND_DATA_TO_BLOCK.
*DISPLAY ALV BLOCK
PERFORM DISPLAY_ALV_BLOCK.
*&---------------------------------------------------------------------*
*& Form INITIALIZE_ALV_BLOCK
*&---------------------------------------------------------------------*
FORM INITIALIZE_ALV_BLOCK .
call function 'REUSE_ALV_BLOCK_LIST_INIT'
exporting
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
.
ENDFORM. " INITIALIZE_ALV_BLOCK
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_BLOCK
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV_BLOCK .
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* IS_PRINT =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " DISPLAY_ALV_BLOCK
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_TO_BLOCK
*&---------------------------------------------------------------------*
FORM APPEND_DATA_TO_BLOCK .
*BUILD FIELDCATALOG
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_T001'
I_STRUCTURE_NAME = 'T001'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
changing
CT_FIELDCAT = IT_FIELDCATALOG
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*APPEND IT_T001
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG
I_TABNAME = 'IT_T001'
IT_EVENTS = IT_EVENTS
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_T001
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*2ND ITAB TO BE DISPLAYED
REFRESH IT_FIELDCATALOG.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_KNB1'
I_STRUCTURE_NAME = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
changing
CT_FIELDCAT = IT_FIELDCATALOG
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*APPEND IT_T001
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG
I_TABNAME = 'IT_KNB1'
IT_EVENTS = IT_EVENTS
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_KNB1
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " APPEND_DATA_TO_BLOCK
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT * INTO TABLE : IT_T001 FROM T001 UP TO 15 ROWS,
IT_KNB1 FROM KNB1 FOR ALL ENTRIES IN
IT_T001
WHERE BUKRS = IT_T001-BUKRS.
ENDFORM. " READ_DATA
No comments:
Post a Comment