report zrpptest01.
tables:mara,marc,makt.
type-pools: slis.
data:alv_container1 type ref to cl_gui_custom_container.
data:alv_container2 type ref to cl_gui_custom_container.
data:alv_grid1 type ref to cl_gui_alv_grid.
data:alv_grid2 type ref to cl_gui_alv_grid.
data:ls_fieldcat type lvc_s_fcat.
data:lt_fieldcat type lvc_t_fcat.
data:ls_fieldcat1 type lvc_s_fcat.
data:lt_fieldcat1 type lvc_t_fcat.
data:alv_layout type lvc_s_layo.
data:alv_layout1 type lvc_s_layo.
class lcl_event_receiver definition deferred. “声明事件类
data: event_receiver type ref to lcl_event_receiver. “声明类的一个对象
data: ok_code type sy-ucomm.
data: begin of itab occurs 0,
werks like marc-werks,
matnr like mara-matnr,
maktx like makt-maktx,
end of itab.
data: itab1 like itab occurs 0 with header line.
class lcl_event_receiver definition. “事件类的定义:方法
public section.
methods:
handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row e_column.
endclass.
parameters: t_werks like marc-werks default 'PWAC'.
select-options: t_matnr for marc-matnr.
start-of-selection.
perform. get_data_form.
end-of-selection.
call screen 100.
module status_0100 output.
SET pf-status 'T100'.
perform. initial_data_form.
endmodule.
module user_command_0100 input.
clear ok_code.
ok_code = sy-ucomm.
case ok_code.
when 'EXIT'.
leave to screen 0.
endcase.
endmodule.
class lcl_event_receiver implementation. “事件类的实现
method handle_double_click.
perform. transfer_data_form. using e_row-index.
Perform. alv2_display_form. “用来显示ALV2的结果
endmethod.
endclass.
*&-----------------------------------------------------------*
*& Form get_data_form
*&-------------------------------------------------------------*
FORM. get_data_form.
select marc~werks marc~matnr makt~maktx
into corresponding fields of itab
from marc
join makt
on marc~matnr = makt~matnr
where marc~werks = t_werks and marc~matnr in t_matnr
and makt~spras = 'EN'.
append itab.
clear itab.
endselect.
ENDFORM.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15117617/viewspace-617066/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15117617/viewspace-617066/