*&---------------------------------------------------------------------*
*& Report ZGDEMO_SIMPLE_ALV_7AM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_SIMPLE_ALV_EVENTS_7AM.
types: begin of TY_EVENTS,
name(30),
form(30),
end of TY_EVENTS.
DATA IT_CSKS TYPE TABLE OF CSKS.
DATA : WA_EVENTS TYPE TY_EVENTS,
IT_EVENTS TYPE TABLE OF TY_EVENTS.
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FILL_EVENTS.
PERFORM DISPLAY_ALV.
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT * INTO TABLE IT_CSKS FROM CSKS
UP TO 20 ROWS.
ENDFORM. " READ_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV .
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 = 'CSKS'
* 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_CSKS
* 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 .
CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'TOP_OF_PAGE'. "EVENT
WA_EVENTS-FORM = 'PRINT_HEADER'(001). "SUBROUTINE
APPEND WA_EVENTS TO IT_EVENTS.
ENDFORM. " FILL_EVENTS
************************************************
* PRINT_HEADER *
************************************************
FORM PRINT_HEADER.
TYPES : BEGIN OF TY_HEADER,
typ(1) type c, " H = Header, S = Selection, A = Action
key(20) type c,
info(60) type c,
END OF TY_HEADER.
DATA : WA_HEADER TYPE TY_HEADER,
IT_HEADER TYPE TABLE OF TY_HEADER.
*1ST LINE
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'Demo to Work With ALV Events'.
APPEND WA_HEADER TO IT_HEADER.
*2ND LINE
WA_HEADER-TYP = 'A'.
WA_HEADER-INFO = 'Demo to Work With ALV Events'.
APPEND WA_HEADER TO IT_HEADER.
*3RD LINE
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'Demo to Work With ALV Events'.
APPEND WA_HEADER TO IT_HEADER.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
IT_LIST_COMMENTARY = IT_HEADER
I_LOGO = 'ENJOYSAP_LOGO'
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM.
*& Report ZGDEMO_SIMPLE_ALV_7AM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_SIMPLE_ALV_EVENTS_7AM.
types: begin of TY_EVENTS,
name(30),
form(30),
end of TY_EVENTS.
DATA IT_CSKS TYPE TABLE OF CSKS.
DATA : WA_EVENTS TYPE TY_EVENTS,
IT_EVENTS TYPE TABLE OF TY_EVENTS.
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FILL_EVENTS.
PERFORM DISPLAY_ALV.
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT * INTO TABLE IT_CSKS FROM CSKS
UP TO 20 ROWS.
ENDFORM. " READ_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV .
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 = 'CSKS'
* 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_CSKS
* 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 .
CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'TOP_OF_PAGE'. "EVENT
WA_EVENTS-FORM = 'PRINT_HEADER'(001). "SUBROUTINE
APPEND WA_EVENTS TO IT_EVENTS.
ENDFORM. " FILL_EVENTS
************************************************
* PRINT_HEADER *
************************************************
FORM PRINT_HEADER.
TYPES : BEGIN OF TY_HEADER,
typ(1) type c, " H = Header, S = Selection, A = Action
key(20) type c,
info(60) type c,
END OF TY_HEADER.
DATA : WA_HEADER TYPE TY_HEADER,
IT_HEADER TYPE TABLE OF TY_HEADER.
*1ST LINE
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'Demo to Work With ALV Events'.
APPEND WA_HEADER TO IT_HEADER.
*2ND LINE
WA_HEADER-TYP = 'A'.
WA_HEADER-INFO = 'Demo to Work With ALV Events'.
APPEND WA_HEADER TO IT_HEADER.
*3RD LINE
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'Demo to Work With ALV Events'.
APPEND WA_HEADER TO IT_HEADER.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
IT_LIST_COMMENTARY = IT_HEADER
I_LOGO = 'ENJOYSAP_LOGO'
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM.
No comments:
Post a Comment