Skip to Content
Author's profile photo Former Member

Customized search for a field in editable ALV


To add customized search help for the field in editable ALV using OOPS concept. This program is to add search help to the field reason for movement, when posting a material document using LI21 transaction. For posting material document you can call MB11 using BDC .


  1. Define a class, and inside the class, define methods for F4 search help in public sections.

METHODS: on_f4 FOR EVENT onf4 OF cl_gui_alv_grid
IMPORTING e_fieldname*                 e_fieldvalue

  1. In private sections, give the data declarations and also the method to fill the F4 help table.

TYPES: BEGIN OF onf4_event_parameters_type.
TYPES: g_fieldname     TYPE lvc_fname.
TYPES: g_row_no        TYPE lvc_s_roid.
TYPES: g_event_data    TYPE REF TO cl_alv_event_data.
TYPES: g_bad_cells     TYPE lvc_t_modi.
TYPES: g_display       TYPE char01.
TYPES: END OF onf4_event_parameters_type.
DATA: f4_params TYPE onf4_event_parameters_type.

  1. Also write the double click method in private section, which is used to place the value into the field after search help.
  2. Define the fieldcat for the search help (note: fields which you want to display on click of search help).
  3. Call a new screen, in which you are going to display the values of search help.
  4. Set the envent_handled  = X. er_event_data->m_event_handled = ‘X’.
  5. On click of serach help, you can get the row id using the field f4_params-g_row_no-row_id.
  6. First read the final internal table , that we will be using to display the ALV, so we can get the entries corresponding to the line we select in the workarea.
  7. Then fetch values from the table that you want to display for F4 search help and put it in an internal table.
  8. Assign that internal table to the f4 internal table(    DATA:f4_itab TYPE STANDARD TABLE OF t157e.)
  9. In the Double click event, use field symbols and assign the data that you get from the f4_params-event data

   ASSIGN f4_params-g_event_data->m_data->* TO <itab>.  

ls_modi-row_id = f4_params-g_row_no-row_id.
    ls_modi-fieldname = f4_params-g_fieldname.

  1. Read the f4_itab table and pass the value to ls_modi-value and finally append ls_modi to <itab>. This will place the value in the field of search help./wp-content/uploads/2012/07/search_120964.png

13.On click of F4:


Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.