如上图,选择报废同一个抬头发票对应的任意一行,其他行的报废也自动勾选,使用event事件来实现,代码如下:
*&---------------------------------------------------------------------*
*& Report ZCNFI_GT03*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report zcnfi_gt03 .
tables :ztavim_comb .
types :
begin of tp_out ,
checkbox ,
field_style type lvc_t_styl , " 为内表添加设置编辑状态所需的字段
vbeln type vbrp -vbeln , "发票抬头
vbelnc type vbrp -vbeln ,
zreject type ztavim_comb -zreject , "报废标记
end of tp_out .
data :
gt_comb type table of ztavim_comb ,
gt_out type table of tp_out .
"ALV
data :
o_grid type ref to cl_gui_alv_grid ,
gt_events type slis_t_event ,
gs_events like line of gt_events ,
wa_layo type lvc_s_layo ,
wa_fcat type lvc_s_fcat ,
gt_fcat type lvc_t_fcat .
*----------------------------------------------------------------------*
* CLASS LCL_EVENT_RECEIVER DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_event_receiver definition . "定义类 捕捉各种事件
public section .
methods handle_modify "数据改变
for event data_changed of cl_gui_alv_grid
importing er_data_changed .
endclass . "LCL_EVENT_RECEIVER DEFINITION
data gt_event_receiver type ref to lcl_event_receiver .
*----------------------------------------------------------------------*
* CLASS lcl_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_event_receiver implementation . "实现类 处理事件
* 界面修改事件
method handle_modify .
perform frm_data_changed using er_data_changed .
endmethod . "HANDLE_MODIFY
endclass . "LCL_EVENT_RECEIVER IMPLEMENTATION
select-options :s_vbeln for ztavim_comb -vbeln .
start-of-selection .
perform frm_data_edit .
perform frm_data_out .
*&-------------------------------------------