FORM frm_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
*&---刷新屏幕数据到内表
DATA: lr_grid1 TYPE REF TO cl_gui_alv_grid,
ls_stable TYPE lvc_s_stbl,
lt_rows TYPE lvc_t_row,
ls_rows LIKE LINE OF lt_rows.
CLEAR:lv_msg,lv_answer.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lr_grid1.
CALL METHOD lr_grid1->check_changed_data.
*&---按钮功能实现
CASE r_ucomm.
WHEN '&DELETE'.
CLEAR:lt_rows.
CALL METHOD lr_grid1->get_selected_rows
IMPORTING
et_index_rows = lt_rows. "选择的行
IF lt_rows IS INITIAL.
lv_msg = '请至少选择一条数据'.
MESSAGE s014(zmdg002) WITH lv_msg DISPLAY LIKE 'E'.
RETURN.
ENDIF.
LOOP AT lt_rows INTO ls_rows.
READ TABLE gt_alv INTO gs_alv INDEX ls_rows-index.
CLEAR:ls_rows,gs_alv.
ENDLOOP.
WHEN OTHERS.
ENDCASE.
****************************** 按钮事件结束 ****************************
CALL METHOD lr_grid1->get_frontend_layout
IMPORTING
es_layout = gs_layout.
*&---调用后数据保存处理
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lr_grid1.
CALL METHOD lr_grid1->refresh_table_display
EXPORTING
is_stable = ls_stable.
ENDFORM. "frm_user_command