Hi Folks,
In order to enable f4 help in you ALV grid a few simple steps are required
1) Declare and implement method on_f4 in your event handler like this:
1a) In the public section of your event receiver declare
methods: on_f4 for event onf4 of cl_gui_alv_grid
importing sender
e_fieldname
e_fieldvalue
es_row_no
er_event_data
et_bad_cells
e_display.
1b) Implement the method
METHOD on_f4.
CALL METHOD ar_my_grid->on_my_f4
EXPORTING
e_fieldname
=
e_fieldname
e_fieldvalue = e_fieldvalue
es_row_no = es_row_no
er_event_data = er_event_data
et_bad_cells = et_bad_cells
e_display = e_display.
ENDMETHOD. "on_f4
2) In your ALV register the event handle for this method
SET HANDLER:
a_event_receiver->on_F4 FOR me.
3 )In your ALV implement a callback method to be called from the event handler
methods: on_my_f4
importing E_FIELDNAME Type LVC_FNAME
E_FIELDVALUE Type LVC_VALUE
ES_ROW_NO Type LVC_S_ROID
ER_EVENT_DATA Type Ref To CL_ALV_EVENT_DATA
ET_BAD_CELLS Type LVC_T_MODI
E_DISPLAY Type CHAR01.
3) Activate and set a break point in the on_my_f4 emthod implementation.
4) to activate F4 for columns of your ALV you need to set the field f4availabl = 'X' in the fieldcatalogue
5) fill table lvc_t_f4 with a line for your field ( see utility form below)
6) call method register_f4_for_fields
Hope this helps. You find a complete example in standard report BCALV_TEST_GRID_F4_HELP
In the next article i'll show how to implement F4 for one of your fields in edit mode.
Cheers
ps. here a little tiny method useful to be called from my build_fieldcatalogue method
METHOD : enable_f4." changing ps_fcat type lvc_s_fcat
" pt_f4 TYPE lvc_t_f4.
DATA: ls_f4 TYPE lvc_s_f4.
ps_fcat-f4availabl = 'X'.
ls_f4-fieldname = ps_fcat-fieldname.
ls_f4-register = 'X'.
ls_f4-getbefore = 'X'.
ls_f4-chngeafter = 'X'.
APPEND ls_f4 TO pt_f4.
ENDMETHOD. ":