Skip to Content
avatar image
Former Member


Hi ,

I added a button SAVE in my alv table. It gets dis played on my alv table also. But I dont know where to write the code for the button to make it work. Please some on help me regarding this issue.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Apr 13, 2011 at 08:44 AM


    In the View, METHODS tab, first you need to create a method for save and under EVENT controller you need to select the ALV event on ON FUNCTION for that alv. there is a help when you click on EVENTS, select this event.

    Methodname           Methodtype                 event*

    Go to the method, there is a parameter R_PARAM type IF_SALV_WD_TABLE_FUNCTION which returns the function that is called.

    You need to write a case statment for each function and write the respective coding


    case r_param~name = 'SAVE'.
    // coding..You can call SAVE method in this and handle your code.



    Edited by: Lekha on Apr 13, 2011 2:16 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Scafandri,

      It is very simple. Follow the stepa i have given below your code will work fine.

      To create a Button in the Alv table:

      data lr_buttonui type ref to cl_salv_wd_fe_button.

      data button1 type ref to cl_salv_wd_function.

      create object lr_buttonui.

      lr_buttonui->set_text( 'Update' ).

      button1 = l_value->if_salv_wd_function_settings~create_function( id = 'SAVE_UP' ).

      button1->set_editor( lr_buttonui ).

      Then create a method name USER_FUNCTION, method Type - Event Handler, Event - ONFUNCTION. And write the below code in that method.

      method user_function .

      case r_param->id.

      when 'SAVE_UP'.

      call method wd_this->save.



      Then create a method SAVE and write your logic as per your requirement. The code will work fine. Get back to me in case of any queries.