Delete Selected Record in ALV Report

form delete_selected_information.
    
  data : i_lines type i.
    
*       Reading the index of the selected row in the ALV grid.
  call method addressbook_grid->get_selected_rows
       importing
            et_index_rows = i_index_rows.
    
*       Check whether a row is selected or not. If not it popups a
*       dialog box as warning to select a row.
  describe table i_index_rows lines i_lines.
    
  if i_lines = 0.
    message i002.
    exit.
  endif.
    
*        Reads the selected rows into work area for display
  loop at i_index_rows into i_selected_row.
    if sy-tabix = 1.
      read table t_intab1 index i_selected_row-index into
      w_intab1.
    endif.
  endloop.
    
  delete t_intab1 where addcode = w_intab1-addcode .
  delete from zc1address where addcode = w_intab1-addcode .
    
  perform refresh_table_information.
    
  if sy-subrc = 0.
    message i003.
  else.
    message i004.
  endif.
    
    
endform." delete_selected_information

Comments

Popular posts from this blog

Export data to xls using OOPS

Factory method ALV sap abap