*&---------------------------------------------------------------------*
*& Report ZGDEMO_ALV_IR_EVENTS_7AM
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_ALV_IR_EVENTS_7AM.
TYPE-POOLS SLIS.
types: begin of TY_eventS,
name(30),
form(30),
end of TY_eventS.
DATA : WA_EVENTS TYPE TY_EVENTS,
IT_EVENTS TYPE TABLE OF TY_EVENTS.
DATA IT_EKKO TYPE TABLE OF EKKO.
*********************************
* START-OF-SELECTION. *
*********************************
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FILL_EVENTS.
PERFORM DISPLAY_ALV.
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT * INTO TABLE IT_EKKO FROM EKKO UP TO 100 ROWS.
ENDFORM. " READ_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV .
DATA WA_PRINT TYPE SLIS_PRINT_ALV.
WA_PRINT-reserve_lines = 2.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* 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 = WA_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_ALV
*&---------------------------------------------------------------------*
*& Form FILL_EVENTS
*&---------------------------------------------------------------------*
FORM FILL_EVENTS .
*TOP_OF_PAGE
CLEAR WA_EVENTS .
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'PRINT_DATA'.
APPEND WA_EVENTS TO IT_EVENTS.
*END_OF_PAGE
CLEAR WA_EVENTS .
WA_EVENTS-NAME = 'END_OF_PAGE'.
WA_EVENTS-FORM = 'PRINT_DATA'.
APPEND WA_EVENTS TO IT_EVENTS.
*USER_COMMAND
CLEAR WA_EVENTS .
WA_EVENTS-NAME = 'USER_COMMAND'.
WA_EVENTS-FORM = 'VALIDATE_COMMANDS'.
APPEND WA_EVENTS TO IT_EVENTS.
ENDFORM. " FILL_EVENTS
************************************************************
* FORM PRINT_DATA.
************************************************************
FORM PRINT_DATA.
types: begin of TY_LIST,
typ(1) type c, " H = Header, S = Selection, A = Action
key(20) type c,
info(60) TYPE C,
end of TY_LIST.
DATA : WA_LIST TYPE TY_LIST,
IT_LIST TYPE TABLE OF TY_LIST.
*1ST LINE
CLEAR WA_LIST.
WA_LIST-TYP = 'H'.
WA_LIST-INFO = 'DEMO ON ALV EVENTS'.
APPEND WA_LIST TO IT_LIST.
*2ND LINE
CLEAR WA_LIST.
WA_LIST-TYP = 'A'.
WA_LIST-INFO = 'DEMO ON ALV EVENTS'.
APPEND WA_LIST TO IT_LIST.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
IT_LIST_COMMENTARY = IT_LIST
I_LOGO = 'EMAX_LOGO'
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM.
*********************************************
* FORM VALIDATE_COMMANDS *
*********************************************
FORM VALIDATE_COMMANDS USING V_UCOMM TYPE SY-UCOMM
SEL_DET TYPE SLIS_SELFIELD.
DATA WA_EKKO TYPE EKKO.
DATA IT_EKPO TYPE TABLE OF EKPO.
CASE V_UCOMM.
WHEN '&IC1'. "DC
READ TABLE IT_EKKO INTO WA_EKKO INDEX SEL_DET-TABINDEX.
SELECT * INTO TABLE IT_EKPO FROM EKPO
WHERE EBELN = WA_EKKO-EBELN.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* 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_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.
ENDCASE.
ENDFORM.
*& Report ZGDEMO_ALV_IR_EVENTS_7AM
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_ALV_IR_EVENTS_7AM.
TYPE-POOLS SLIS.
types: begin of TY_eventS,
name(30),
form(30),
end of TY_eventS.
DATA : WA_EVENTS TYPE TY_EVENTS,
IT_EVENTS TYPE TABLE OF TY_EVENTS.
DATA IT_EKKO TYPE TABLE OF EKKO.
*********************************
* START-OF-SELECTION. *
*********************************
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FILL_EVENTS.
PERFORM DISPLAY_ALV.
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT * INTO TABLE IT_EKKO FROM EKKO UP TO 100 ROWS.
ENDFORM. " READ_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV .
DATA WA_PRINT TYPE SLIS_PRINT_ALV.
WA_PRINT-reserve_lines = 2.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* 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 = WA_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_ALV
*&---------------------------------------------------------------------*
*& Form FILL_EVENTS
*&---------------------------------------------------------------------*
FORM FILL_EVENTS .
*TOP_OF_PAGE
CLEAR WA_EVENTS .
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'PRINT_DATA'.
APPEND WA_EVENTS TO IT_EVENTS.
*END_OF_PAGE
CLEAR WA_EVENTS .
WA_EVENTS-NAME = 'END_OF_PAGE'.
WA_EVENTS-FORM = 'PRINT_DATA'.
APPEND WA_EVENTS TO IT_EVENTS.
*USER_COMMAND
CLEAR WA_EVENTS .
WA_EVENTS-NAME = 'USER_COMMAND'.
WA_EVENTS-FORM = 'VALIDATE_COMMANDS'.
APPEND WA_EVENTS TO IT_EVENTS.
ENDFORM. " FILL_EVENTS
************************************************************
* FORM PRINT_DATA.
************************************************************
FORM PRINT_DATA.
types: begin of TY_LIST,
typ(1) type c, " H = Header, S = Selection, A = Action
key(20) type c,
info(60) TYPE C,
end of TY_LIST.
DATA : WA_LIST TYPE TY_LIST,
IT_LIST TYPE TABLE OF TY_LIST.
*1ST LINE
CLEAR WA_LIST.
WA_LIST-TYP = 'H'.
WA_LIST-INFO = 'DEMO ON ALV EVENTS'.
APPEND WA_LIST TO IT_LIST.
*2ND LINE
CLEAR WA_LIST.
WA_LIST-TYP = 'A'.
WA_LIST-INFO = 'DEMO ON ALV EVENTS'.
APPEND WA_LIST TO IT_LIST.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
IT_LIST_COMMENTARY = IT_LIST
I_LOGO = 'EMAX_LOGO'
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM.
*********************************************
* FORM VALIDATE_COMMANDS *
*********************************************
FORM VALIDATE_COMMANDS USING V_UCOMM TYPE SY-UCOMM
SEL_DET TYPE SLIS_SELFIELD.
DATA WA_EKKO TYPE EKKO.
DATA IT_EKPO TYPE TABLE OF EKPO.
CASE V_UCOMM.
WHEN '&IC1'. "DC
READ TABLE IT_EKKO INTO WA_EKKO INDEX SEL_DET-TABINDEX.
SELECT * INTO TABLE IT_EKPO FROM EKPO
WHERE EBELN = WA_EKKO-EBELN.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* 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_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.
ENDCASE.
ENDFORM.
No comments:
Post a Comment