Skip to Content
0
Former Member
May 20, 2010 at 07:39 PM

How to Add Customer Button to ALV?

461 Views

Hello Forums,

I have this ALV code and my grid is displaying, I would like to add a button at the top to say 'Add Record' and then a delete record button I have tried using the Add_function of the cl_salv_functions_list class but if just errors out?

Is that the right method to use? Am I calling it incorrectly?

thanks

  TRY.
      cl_salv_table=>factory(
          IMPORTING r_salv_table = gr_alv
          CHANGING  t_table      = gt_leg_gl ).

      gr_functions = gr_alv->get_functions( ).

      gr_functions->set_all('X').

      gr_functions->set_group_filter( value = if_salv_c_bool_sap=>false ).

*       Set print preview
      gr_functions->set_print_preview( ).

      gr_alv->display( ).

    CATCH cx_salv_msg.
      MESSAGE 'ALV Display Not possible'(w02) TYPE 'I' DISPLAY LIKE 'E'.
  ENDTRY.