cancel
Showing results for 
Search instead for 
Did you mean: 

About OO ALV Event

Former Member
0 Kudos

hi, all

How can i get the event of fields f4 help?

Thanks for your help?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

you can reffer this standard program or reffer the document

BCALV_GRID_EDIT_DELTA.

Linking F4 Help to Fields

1. Local event handler class definition:

CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

METHODS:handle_onf1

FOR EVENT onf4 OF cl_gui_alv_grid

IMPORTING e_fieldname es_row_no er_event_data .

PRIVATE SECTION.

ENDCLASS. "lcl_event_handler DEFINITION

2. Local event handler class implementation:

Here we set the attribute “er_event_data->m_event_handled” to prevent further processing of

standard F1 help.

CLASS lcl_event_handler IMPLEMENTATION.

METHOD handle_onf4.

PERFORM handle_onf4 USING e_fieldname es_row_no .

er_event_data->m_event_handled = 'X'.

ENDMETHOD.

ENDCLASS. "lcl_event_handler IMPLEMENTATION

3. Creating an instance:

The following statement creates an instance for the event handler.

DATA gr_event_handler TYPE REF TO lcl_event_handler.

CREATE OBJECT gr_event_handler.

4. Registering handler methods to handle ALV grid events:

The following statement registers handler methods to handle ALV Grid events

SET HANDLER gr_event_handler->handle_onf4 FOR gr_alvgrid.

- 26 -

5. Registering the table of the type “LVC_T_F4”:

For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this

you must prepare a table of type “LVC_T_F4” and register this table using the method

“register_f4_for_fields”. 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 ‘FIELDNAME’

•Set ‘REGISTER’ to make the field regsitered,

•Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode

•Set ‘CHNGEAFTER’ 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[] .

6. Method ‘handle_onf4’:

The following method allows the user to link the F4 help with the ALV Grid.

This event has three parameters in its interface. The parameter “es_row_no” which is of type

“LVC_S_ROID” passes information about the row index at “es_row_no-row_id”.

&----


*& Form handle_onf4

&----


  • text

----


  • -->P_E_FIELDNAME text

  • -->P_ES_ROW_NO text

  • -->P_ER_EVENT_DATA text

----


FORM handle_onf4 USING p_e_fieldname

p_es_row_no STRUCTURE lvc_s_roid .

……

ENDFORM. " handle_onf4

reward me its useful

regards

Ravoi

Clemenss
Active Contributor
0 Kudos

Hi pei li,

It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. 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 ‘FIELDNAME’

􀂾 Set ‘REGISTER’ to make the field registered,

􀂾 Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode

􀂾 Set ‘CHNGEAFTER’ 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[] .
...
METHOD handle_on_f4 .
  PERFORM f4_help USING e_fieldname es_row_no .
* set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
  er_event_data->m_event_handled = 'X' .
ENDMETHOD
...

[found here: <a href="http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">An Easy Reference for ALV Grid Control</a>

Regards,

Clemens

sharat_chandra
Active Participant
0 Kudos

Hi,

You can use the DATA_CHANGED event of CL_GUI_ALV_GRID. Here you can check if F4 has triggered the event using the parameter E_ONF4.

Former Member
0 Kudos

Event is AT VALUE REQUEST

or in module pool Process On Value Request

Regards

Sushil

Former Member