‎2009 Feb 11 2:35 PM
Hi,
I am crating ALV using class.
There I have one field MATERIAL NUMBER.
In ALV cell I have to give F4 help for that field.
How to proceed with that.
‎2009 Feb 11 2:39 PM
in the field catalog use.. ref_table and referancefield with suitable table name and field name.
‎2009 Feb 11 2:39 PM
in the field catalog use.. ref_table and referancefield with suitable table name and field name.
‎2009 Feb 11 2:42 PM
populate itab1 with the values that are to be displayed, and pass this to this FM.
Now use,
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'itab-field name' "-->Field for which dropdown is needed.
values = i_tab1 "->values that u need to display in the Dropdown
EXCEPTIONS
id_illegal_name = 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.
chk this std prg for ref:
BCALV_F4
BCALV_TEST_GRID_F4_HELP
‎2009 Feb 11 2:45 PM
Hi Sandeep,
Check out the standard SAP reports
BCALV_TEST_GRID_EVENTS
BCALV_TEST_GRID_F4_HELP
Tell me if it helps
‎2009 Feb 11 2:47 PM
use event onf4
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
DATA : er_event_data TYPE REF TO cl_alv_event_data,
er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
METHODS:
on_f4 FOR EVENT onf4 OF cl_gui_alv_grid
IMPORTING e_fieldname
es_row_no
er_event_data
et_bad_cells
e_display.
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION .
METHOD on_f4.
PERFORM on_f4 USING e_fieldname
es_row_no-row_id
er_event_data
et_bad_cells
e_display
er_data_changed.
er_event_data->m_event_handled = gc_x.
ENDMETHOD. "on_f4
‎2009 Feb 11 2:55 PM
Hi,
Jus go through this.
define, implement and register the event u201Conf4u201D at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the u201Conf4u201D event. For this you must prepare a table of type u201CLVC_T_F4u201D and register this table using the method u201Cregister_f4_for_fieldsu201D. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
􀂾 Pass the fieldname to u2018FIELDNAMEu2019
􀂾 Set u2018REGISTERu2019 to make the field registered,
􀂾 Set u2018GETBEFOREu2019 to provide field content transport before F4 in editable mode
􀂾 Set u2018CHNGEAFTERu2019 to make the data changed after F4 in editable mode.
DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
.. ..
lt_f4-fieldname = 'PRICE'.
lt_f4-register = 'X' .
lt_f4-getbefore = 'X' .
APPEND lt_f4 .
CALL METHOD gr_alvgrid->register_f4_for_fields
EXPORTING
it_f4 = lt_f4[]
A sample u201Conf4u201D method implementation:
METHOD handle_on_f4 .
PERFORM f4_help USING e_fieldname es_row_no .
er_event_data->m_event_handled = 'X' .
ENDMETHOD .
Again, we set the attribute u201Cer_event_data->m_event_handledu201D to prevent further processing of standard F4 help.
Regards
Sandeep REddy
‎2009 Feb 11 3:13 PM
Hi,
you just check with demo program BCALV_GRID_EDIT
Regards,
Anki Reddy