*&---------------------------------------------------------------------*
*& Report ZDEMO_ALVLIST1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZDEMO_ALVLIST1.
INCLUDE zdemo_alv_top. "copy the alv top as include
PARAMETERS p_bstyp TYPE ebstyp DEFAULT 'F'.
START-OF-SELECTION.
PERFORM read_data_from_ekko.
PERFORM fill_events_tab.
end-of-SELECTION.
PERFORM display_data_using_alv.
*&---------------------------------------------------------------------*
*& Form display_data_using_alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form display_data_using_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-cprog
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = 'EKKO'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = it_events
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_ekko
* 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_data_using_alv
*&---------------------------------------------------------------------*
*& Form fill_events_tab
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM fill_events_tab.
CLEAR wa_events.
wa_events-name = 'TOP_OF_PAGE'.
wa_events-form = 'PRINT_HEADING'.
APPEND wa_events to it_events.
CLEAR wa_events.
wa_events-name = 'USER_COMMAND'.
wa_events-form = 'VALIDATE_COMMAND'.
APPEND wa_events to it_events.
CLEAR wa_events.
wa_events-name = 'PF_STATUS_SET'.
wa_events-form = 'ATTACH_STATUS'.
APPEND wa_events to it_events.
endform. "fill_events_tab
*&---------------------------------------------------------------------*
*& Form PRINT_HEADING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PRINT_HEADING.
data it_headings TYPE slis_t_listheader.
data wa_headings LIKE LINE OF it_headings.
CLEAR wa_headings.
wa_headings-typ = 'H'.
wa_headings-info = 'List of purchasing documents'.
APPEND wa_headings to it_headings.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_headings
I_LOGO = 'LOGO'
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM. "PRINT_HEADING
*&---------------------------------------------------------------------*
*& Form read_data_from_ekko
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM read_data_from_ekko.
select * INTO TABLE it_ekko FROM ekko UP TO 13 ROWS.
ENDFORM. "read_data_from_ekko
*&---------------------------------------------------------------------*
*& Form VALIDATE_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UCOMM text
* -->SEL_DET text
*----------------------------------------------------------------------*
FORM VALIDATE_COMMAND USING ucomm LIKE sy-ucomm sel_det TYPE slis_selfield.
case ucomm.
WHEN 'DETAIL'.
IF NOT it_ekko is INITIAL.
SELECT * INTO TABLE IT_EKPO FROM EKPO FOR ALL ENTRIES IN IT_EKKO WHERE EBELN = IT_EKKO-EBELN.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = 'EKPO'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = IT_EVENTS
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_EKPO
* 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.
ENDIF.
ENDCASE.
ENDFORM. "VALIDATE_COMMAND
*&---------------------------------------------------------------------*
*& Form ATTACH_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->EX_TAB text
*----------------------------------------------------------------------*
FORM ATTACH_STATUS USING ex_tab TYPE slis_t_extab.
set PF-STATUS 'ZDEMO' EXCLUDING ex_tab.
ENDFORM. "ATTACH_STATUS
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.