REUSE_ALV_EVENTS_GET

REUSE_ALV_EVENTS_GET: Returns table of possible events for a list type
=======================================================================
After preparing the fieldcatalog the next step is to build an event table for both user commands and system dependent events like top of page, end of page etc. and to print data at the top of the list, at the end of the list and handling
user action on the list.
A list of possible events is populated into an event table i_events.When this table is passed from the function module REUSE_ALV_EVENT_NAMES_GET the  function module returns all the possible events for a list type.
The purpose of REUSE_ALV_EVENTS_GET is, in your ALV Program you have any HEADER part for that you write a form Top-of-page and you mention in ALV function module, for calling that subroutine this function moodule is used.
The i_event internal table is of TYPE SLIS_T_EVENT(i.e., ET_EVENTS TYPE SLIS_T_EVENT).
This table i_events contains all the events wrapped up in the ALV LIST or ALV GRID and i_event also consists of two fields NAME and FORM.
The name field of the table holds the name of the events like TOP-OF-PAGE and END-OF-PAGE, USER-COMMAND and form will contain the name of the FORM ROUTINE that will be called dynamically through callback mechanism when the particular event will fire.i_event is initial for all events as default.
*&———————————————————————*
*&      Form  EVENT_TAB                                                *
*&———————————————————————*
*       subroutine for populating the events                           *
*———————————————————————-*
FORM event_tab .
* Call FM ‘REUSE_ALV_EVENTS_GET’ to get the events
CALL FUNCTION ‘REUSE_ALV_EVENTS_GET’
EXPORTING
i_list_type     = 0
IMPORTING
et_events       = i_event
EXCEPTIONS
list_type_wrong = 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.
ENDFORM.                    ” EVENT_TAB
* READING THE EVENT FOR THE HEADER
READ TABLE i_event INTO w_event WITH KEY name = ‘TOP_OF_PAGE’ .
IF sy-subrc = 0.
w_event-form = ‘TOP_OF_PAGE’.
MODIFY i_event FROM w_event INDEX sy-tabix TRANSPORTING form.
========================================================================
In the above function-module check the statement w_event-form = ‘TOP-OF-PAGE’.
Here the form routine ‘TOP-OF-PAGE’ is being set up for the event TOP_OF_PAGE
event which will fire when the ALV LIST will be displayed, this form will be called
dynamically by the ALV list display during TOP-OF-PAGE event and for this,the modified
events internal table has to be passed to the FM ‘REUSE_ALV_LIST_DISPLAY’ in the exporting parameter IT_EVENTS.Failing this the form ‘TOP_OF_PAGE’ will not be called.
This event is used for placing heading information like showing current date and time or the name of the report at the top of the report.
Posted by: Cinthia Nazneen

One Comment

  1. sgs Says:

    plz show the screen shots if possible

Leave a Comment