10-09-2007 7:40 AM
hi,
i have the following doubt:
The FM REUSE_ALV_EVENTS_GET is called and i_events is passed to collect all events.
Then I have been told to collect event USER_COMMAND into wa_event and then modify i_events with wa_events.
How to do all this??
10-09-2007 7:42 AM
The code below shows how to use the function module..
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_events[]
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.
READ TABLE gt_events
INTO gx_events
WITH KEY name = slis_ev_top_of_page
.
IF sy-subrc = 0.
ls_index = sy-tabix.
gx_events-form = 'TOP-OF-PAGE'.
MODIFY gt_events FROM gx_events INDEX ls_index.
ENDIF.
10-09-2007 7:45 AM
Hi,
do like this.
For ALV events
i_events TYPE slis_t_event,
constants : c_user_command(20) value 'USER_COMMAND'
Local variable for event
DATA: wa_event TYPE slis_alv_event. "Events
Events for the ALV
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 1 "2
IMPORTING
et_events = i_events.
Sort by Name
SORT i_events BY name.
CLEAR wa_event.
READ TABLE i_events INTO wa_event
WITH KEY name = slis_ev_user_command
BINARY SEARCH.
IF sy-subrc = 0.
MOVE c_user_command TO wa_event-form.
MODIFY i_events FROM wa_event TRANSPORTING form
WHERE name = slis_ev_user_command.
ENDIF.
CLEAR : wa_event.
Reward if helpful.
Regards,
Nagaraj
10-09-2007 7:46 AM
Hi,
REUSE_ALV_EVENTS_GET is used to get all the possible events,
Once this FM is executed your itab will be filled with all possible events and you have to associate a FORM that has to be called when a particular event is triggered in your case when USER_COMMAND is triggered which sub routine has to be called.
READ itab into wa_event WITH KEY event = USER_COMMAND .
wa_event-formname = 'your subroutine name'.
MODIFY itab FROM wa_event INDEX sy-tabix.
later you have to pass this itab to your Display FM.
Regards,
Raghavendra
10-09-2007 7:47 AM
Hi,
Use this code
&----
*& Form sub_create_events *
&----
This form will display the ALV Events *
----
FORM sub_create_events .
*--Local Work Area
DATA: lwa_event TYPE slis_alv_event. "Work area for Events
*--Call Function to display the events for the ALV
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 1
IMPORTING
et_events = i_events.
*--Sort by Name
SORT i_events BY name.
*--Clear
CLEAR lwa_event.
READ TABLE i_events INTO lwa_event WITH KEY name = slis_ev_top_of_page
BINARY SEARCH.
IF sy-subrc = 0.
MOVE c_top_of_page TO lwa_event-form.
MODIFY i_events FROM lwa_event TRANSPORTING form WHERE
name = slis_ev_top_of_page.
ENDIF.
CLEAR : lwa_event.
ENDFORM. "sub_create_events
Regards,
Prashant
10-09-2007 7:56 AM
call function 'REUSE_ALV_EVENTS_GET'
importing
et_events = t_event
exceptions
list_type_wrong = 1
others = 2.
if sy-subrc <> 0.
endif.
clear w_event.
w_event-form = 'SUB_USER_COMMAND'.
modify t_event from w_event transporting form
where name = 'USER_COMMAND'.
clear w_event.
w_event-form = 'SUB_TOP_PAGE'.
modify t_event from w_event transporting form
where name = 'TOP_OF_PAGE'.
&----
*& Form sub_user_command
&----
form sub_user_command using p_ucomm type sy-ucomm
p_seltab type slis_selfield.
get cursor field v_field value v_value.
perform sub_get_vbap.
perform sub_build_fcat1.
perform display_vbap.
endform. " sub_user_command
&----
*& Form sub_top_page
&----
form sub_top_page .
clear: t_listheader[].
w_listheader-typ = 'H'.
w_listheader-info = 'ALV TOP OF PAGE'.
append w_listheader to t_listheader.
w_listheader-typ = 'S'.
w_listheader-info = sy-datum.
append w_listheader to t_listheader.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_listheader.
endform. " sub_top_page
reward points if helpful.........