report.
type-pools: slis.
data: ls_layout type slis_layout_alv.
ls_layout-zebra = 'X'. "斑马线
ls_layout-colwidth_optimize = 'X'. "宽度自动优化
ls_layout-box_fieldname = 'ZSEL'. "在对应的内表中也要定义一个选
data: it_cat type slis_t_fieldcat_alv with header line.
define alv_head.
clear it_cat.
it_cat-fieldname = '&1'.
it_cat-seltext_m = '&2'.
append it_cat.
end-of-definition.
data: begin of gt_likp occurs 0,
zsel type c,
vbeln like likp-vbeln,
vkorg like likp-vkorg,
end of gt_likp.
data: begin of gt_lips occurs 0,
zsel type c,
vbeln like lips-vbeln,
posnr like lips-posnr,
matnr like lips-matnr,
lfimg like lips-lfimg,
end of gt_lips.
start-of-selection.
select vbeln vkorg into corresponding fields of table gt_likp
from likp up to 20 rows.
clear it_cat[].
alv_head vbeln 交货.
alv_head vkorg 销售组织.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = 'FRM_ALV_COMMAND'
is_layout = ls_layout
it_fieldcat = it_cat[]
tables
t_outtab = gt_likp.
*&---------------------------------------------------------------------*
*& Form frm_salv_commond
*&---------------------------------------------------------------------*
form frm_alv_command using p_ucomm like sy-ucomm
rs type slis_selfield.
data: lr_grid type ref to cl_gui_alv_grid.
case p_ucomm.
when '&IC1'. "双击
if rs-fieldname = 'VBELN'.
perform frm_display_detail using rs-value.
endif.
endcase.
endform. "frm_salv_commond
*&---------------------------------------------------------------------*
*& Form frm_display_detail
*&---------------------------------------------------------------------*
form frm_display_detail using p_value.
select vbeln posnr matnr lfimg into corresponding fields of table gt_lips
from lips
where vbeln = p_value.
clear it_cat[].
alv_head vbeln 交货.
alv_head posnr 交货行项目.
alv_head matnr 物料号.
alv_head lfimg 交货数量.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = 'FRM_ALV_COMMAND'
is_layout = ls_layout
it_fieldcat = it_cat[]
tables
t_outtab = gt_lips.
endform. "frm_display_detail
评论