Skip to Content
avatar image
Former Member

Inserting row in ALV

hi experts ..

I want to add a row in the alv when i click on add button..

I know there is insert row and append row buttons available in alv but i dont want those names ..

Can i change the name of standard buttons or is there sm class that i can use to develop this functionality.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jun 29, 2007 at 04:36 AM

    Hi Jagruti,

    You just have to add a new button with whatever name you want, and map it to the existing functionality in ALV. It will work and you dont need to do anything else.

    The code will be:


    lr_button type ref to cl_salv_wd_fe_button,

    lr_function type ref to cl_salv_wd_function.

    CREATE OBJECT lr_button.

    lr_button->set_text( 'Your text' ).

    lr_button->set_tooltip( 'Your tooltip' ).

    lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'INSERT' ).

    <b>lr_function->set_function_std( IF_SALV_WD_C_STD_FUNCTIONS=>EDIT_APPEND_ROW ).</b>

    lr_function->set_editor( lr_button ).

    The method set_function_std sets your funcion to take the behaviour of the standard ALV function for inserting rows. So it would work automatically. You have only changed the text.

    <b>If your problem is solved, please award points and close the threads. Couple of your previous threads are still open, please close them</b>



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Jagruti,

      Include the following code before inserting the new function.

      data: lt_std_func TYPE salv_wd_t_function_std_ref,

      ls_std_func TYPE salv_wd_s_function_std_ref.

      lt_std_func = l_alv_model->if_salv_wd_function_settings~get_functions_std( ).

      LOOP AT lt_std_func INTO ls_std_func.

      ls_std_func-r_function->set_visible( if_wdl_core=>visibility_none ).


      We have set ALL the standard functions here as not visible. If you want to set only a particular function as invisible, say only the insert row, then get_function_std by passing the ID of the function and set that only as invisible. Do this depending on your requirement.

      <b>Please award points and close the thread.</b>