cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create ALV Table with Edit and Delete Buttons

Former Member
0 Kudos

Hi Experts,

I need to create a ALV table with EDIT and DELETE button for each row,where when clicking on EDIT i should be able to EDIT the entire row and when clicking on SAVE it should SAVE the changes made,and on CLICKING DELETE Button i should be able to DELETE the Row from the Table.

please help with the code.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

We have STandard buttons in ALv for Inserting and Deleting row.

You dont wnat to use those options???

Cheers,

Kris

Answers (2)

Answers (2)

Former Member
0 Kudos

kissnas, i wil create a pop window to insert new entries and that is a different one.

cheers,

krrish.

Former Member
0 Kudos

Hi,

Try with this...

* create an instance of ALV component
  DATA:    lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage.
* get ALV component
  DATA:    lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.

  DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
        lr_column type ref to CL_SALV_WD_COLUMN,
        lr_column_hdr type ref to CL_SALV_WD_COLUMN_HEADER,
        lr_button TYPE REF TO cl_salv_wd_uie_button.
 
  lr_salv_wd_table_usage = wd_this->wd_cpuse_<Alv component usage name>( ).
  IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
    lr_salv_wd_table_usage->create_component( ).
  ENDIF.
 
  lr_salv_wd_table = wd_this->wd_cpifc_<Alv component usage name>( ).
  wd_this->alv_table = lr_salv_wd_table->get_model( ).

 lr_column_settings ?= wd_this->alv_table.
 lr_column = lr_column_settings->get_column( '<column name which you want to show  as button>' ).
CREATE OBJECT lr_button.
  lr_button_1->set_text( '<some releavnt text>' ). // your button text
  lr_column->set_cell_editor( lr_button).

Cheers,

Kris.

saravanan_narayanan
Active Contributor
0 Kudos

Hello TGP,

You need to create a custom column in the ALV table using the CREATE_COLUMN method of the IF_SALV_WD_COLUMN_SETTINGS and then bind the instance of SALV BUTTON ui element as suggested by Kris.

BR, Saravanan

Former Member
0 Kudos

Thanks experts.

Regards,

Krrish.

Former Member
0 Kudos

Hi Thnx for response,

i dont want to use them, i need an EDIT/DELETE Buttons in my table for every row,so that i can EDIT/DELETE the rows.