10-03-2007 7:08 AM
Hi all.
We are using 'REUSE_ALV_EVENTS_GET' FM in ALV program. please tell me what is the use of this function module. What will happens if we not use this function module in our program.
Regards.
Prajwal.k
10-03-2007 7:15 AM
Hi Prajwal,
Function module REUSE_ALV_EVENTS_GET returns table of possible events for a list type into a internal table.
This is basically to get the events used for processing of ALV's. It will returns table of possible events for a list type.
This function module returns a table of event names.The table has 2 fields they are NAME and FORM.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = rt_events.
Read table rt_event with key name and put the corresponding subroutine name in corresponding field of the event. As under :
Read table rt_event with key name and put the corresponding subroutine name in corresponding field of the event. As under :
read table rt_events with key name = slis_ev_top_of_page into ls_event.
if sy-subrc = 0.
move g_top_of_page to ls_event-form.
append ls_event to rt_events.
endif.
Here slis_ev_top_of_page is a constant defined in type pool SLIS having value
TOP_OF_PAGE. Also, g_top_of_page = TOP_OF_PAGE. A list or internal table is prepared having all the events and corresponding columns have the subroutine name that will be called on occurrence of the event.So same if performed for all events.
TOP_OF_PAGE event will call this subroutine.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
endform.
Reward if helpful.
Regards,
Harini.S
10-03-2007 7:15 AM
This is basically to get the events used for processing of ALV's. It will returns table of possible events for a list type.
This function module returns a table of event names.The table has 2 fields they are NAME and FORM.
When importing parameter I_LIST_TYPE = 0, it will returns all possible events in table ET_EVENTS.
ET_EVENTS-NAME contains the event names.
And later u have to modify this returned table ET_EVENTS with ur form names.
Function module REUSE_ALV_EVENTS_GET returns table of possible events for a list type into a internal table.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = rt_events.
Read table rt_event with key name and put the corresponding subroutine name in corresponding field of the event. As under :
Read table rt_event with key name and put the corresponding subroutine name in corresponding field of the event. As under :
read table rt_events with key name = slis_ev_top_of_page into ls_event.
if sy-subrc = 0.
move g_top_of_page to ls_event-form.
append ls_event to rt_events.
endif.
Here slis_ev_top_of_page is a constant defined in type pool SLIS having value
TOP_OF_PAGE. Also, g_top_of_page = TOP_OF_PAGE. A list or internal table is prepared having all the events and corresponding columns have the subroutine name that will be called on occurrence of the event.So same if performed for all events.
TOP_OF_PAGE event will call this subroutine.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
endform.
You have to call your function like this:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
...
I_CALLBACK_PROGRAM = z_variant-report
(or your program name, not sy-repid because this will
change during the use of ALV Grid)
I_CALLBACK_USER_COMMAND = 'USER_COMMAND2'
(or some other name)
...
then you define your form:
form user_command2 using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'. (doubleclick)
if rs_selfield-tabindex > 0 and
rs_selfield-sumindex le 0.
read table itab into wa index
rs_selfield-tabindex.
perform second_grid.
endif.
endcase.
then your form for the second grid:
form second_grid.
(here you can make your selections for the second grid
based on the row you selected into workarea wa from the
first grid, and then call REUSE_ALV_GRID_DISPLAY again,
with another field catalog, internal table etc...)
endform.
good luck.
10-03-2007 7:31 AM
Hi Kaushik
you told that it is basically used to get events used for processing of ALV.please tell me about events in ALV, what are the events used in alv.
10-03-2007 7:21 AM
Whenever u are using EVENTS in ALV u need to use this FM..
Wat this FM does is it fills up the table of events..there are 17 events dat r used in ALV...the actions that need 2 b done wen any of these events occur is written in a PERFORM and the name of this FORM is passed on to the event table in ALV..
This FM populates the events table which has 2 columns..
1.Event
2.Form Name.
and we specify that on which events which perform shud be called.
Accordingly as the events are triggered the respective actions(as specified in dat perform) get called.
Hope it helps...
10-03-2007 7:24 AM
FU REUSE_ALV_EVENTS_GET
Returns table of possible events for a list type
Functionality
This table can be passed to the ALV display module with the form name.
Parameters
I_LIST_TYPE
ET_EVENTS
Exceptions
LIST_TYPE_WRONG
Function Group
SALV