FORM frm_user_command03 USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
DATA: lr_grid TYPE REF TO cl_gui_alv_grid.
DATA: lt_zmmt036 LIKE TABLE OF zmmt036 WITH HEADER LINE,
lt_dd07t LIKE TABLE OF dd07t WITH HEADER LINE.
DATA:lv_answer TYPE c.
REFRESH lt_zmmt036.
CLEAR lt_zmmt036.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lr_grid.
CALL METHOD lr_grid->check_changed_data.
selfield-refresh = 'X'.
CASE ucomm.
WHEN '&IC1'. "双击
WHEN '&F03'.
LEAVE TO SCREEN 0.
WHEN 'ZDEL'.
READ TABLE gt_output03 TRANSPORTING NO FIELDS WITH KEY box = 'X'.
IF sy-subrc <> 0.
MESSAGE '请先选择报价' TYPE 'E'.
ENDIF.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = '请确认'
text_question = '确认删除报价吗'
icon_button_1 = 'Yes'
icon_button_2 = 'No'
default_button = '2'
display_cancel_button = ''
start_column = 25
start_row = 6
IMPORTING
answer = lv_answer
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
IF lv_answer = '1'.
LOOP AT gt_output03 INTO gs_output03 WHERE box = 'X'.
IF gs_output03-zstatus <> 1 AND gs_output03-zstatus <> 4. "仅允许删除未提交和审批未通过的
gs_output03-icon = icon_red_light.
gs_output03-msgtx = '当前审批状态不允许删除'.
CONTINUE.
ENDIF.
DELETE FROM zmmt036 WHERE zbjh = gs_output03-zbjh AND zxmh = gs_output03-zxmh.
COMMIT WORK.
IF sy-subrc = 0.
gs_output03-icon = icon_green_light.
gs_output03-msgtx = '删除成功'.
ELSE.
gs_output03-icon = icon_red_light.
gs_output03-msgtx = '删除失败'.
ENDIF.
MODIFY gt_output03 FROM gs_output03.
CLEAR gs_output03.
ENDLOOP.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDFORM.