*&---------------------------------------------------------------------*
*& Report ZMMR011
*&
*&---------------------------------------------------------------------*
*&程序名称:供应商、工厂对应公里数维护
*&事物代码:ZMM031
*&导入模板:无
*&作者:董冬
*&时间:2016/3/2
*&更新时间:2016/3/3
*&---------------------------------------------------------------------*
REPORT zmmr011.
TABLES: tvbvk ,cskt ,ztmm002.
TYPES:ty_xs LIKE v_tvbur.
DATA:gt_xs LIKE TABLE OF v_tvbur.
DATA:wa_xs TYPE v_tvbur.
DATA:edit(1) VALUE ''."ALV是否处于可编辑状态
DATA:lt_lfa1 TYPE lfa1 OCCURS 0 WITH HEADER LINE. "供应商内表
DATA:lt_t001w TYPE t001w OCCURS 0 WITH HEADER LINE."工厂内表
FIELD-SYMBOLS: <f1>, <f2>, <f3>.
TYPES:BEGIN OF ty_tab.
INCLUDE TYPE ztmm002.
TYPES: lifnr_name LIKE lfa1-name1,
werks_name LIKE t001w-name1.
TYPES:END OF ty_tab.
DATA :gt_zz TYPE STANDARD TABLE OF ty_tab .
DATA:wa_zz TYPE ty_tab.
FORM get_data.
* CALL FUNCTION 'VIEW_GET_DATA'
* EXPORTING
* view_name = 'V_TVBUR'
* TABLES
* data = gt_xs.
SELECT *
FROM lfa1
INTO CORRESPONDING FIELDS OF TABLE lt_lfa1.
SELECT *
FROM t001w
INTO CORRESPONDING FIELDS OF TABLE lt_t001w.
SELECT *
FROM ztmm002
INTO CORRESPONDING FIELDS OF TABLE gt_zz.
LOOP AT gt_zz INTO wa_zz.
READ TABLE lt_lfa1 WITH KEY lifnr = wa_zz-lifnr.
wa_zz-lifnr_name = lt_lfa1-name1.
READ TABLE lt_t001w WITH KEY werks = wa_zz-werks.
wa_zz-werks_name = lt_t001w-name1.
MODIFY gt_zz FROM wa_zz.
ENDLOOP.
ENDFORM.
DATA: gs_fcat TYPE lvc_s_fcat,
gt_fcat TYPE lvc_t_fcat,
gs_layo TYPE lvc_s_layo,
gs_grid TYPE lvc_s_glay.
DATA: gt_event TYPE slis_t_event WITH HEADER LINE,
gt_event_exit TYPE slis_t_event_exit WITH HEADER LINE.
DATA: ref_grid TYPE REF TO cl_gui_alv_grid .
"parameters: p_ds type c as checkbox.
START-OF-SELECTION.
PERFORM get_data.
PERFORM show_data_to_alv.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_modify
FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified et_good_cells.
METHODS data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_modify.
* PERFORM refresh.
DATA stbl TYPE lvc_s_stbl.
stbl-row = 'X'." 基于行的稳定刷新
stbl-col = 'X'." 基于列稳定刷新
CALL METHOD ref_grid->refresh_table_display
EXPORTING
is_stable = stbl.
ENDMETHOD.
METHOD data_changed.
DATA: ls_mod_cells