Code: Alles auswählen.
class lcl_event_receiver implementation.
method handle_data_changed.
data: ls_good type lvc_s_modi,
error_in_data(1) type c,
neu_einheit type meins,
check_meinh type meinh,
neu_matnr type matnr,
neu_menge type z001_sapin02p-menge.
error_in_data = space.
* break-point.
loop at er_data_changed->mt_good_cells into ls_good.
case ls_good-fieldname.
* CHECK: Ist die Menge mit gültigen Werten gefüllt?
when 'MENGE_3'.
call method er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = neu_menge.
call method er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = 'EINHEIT_3'
IMPORTING
e_value = neu_einheit.
if neu_einheit = ' '.
MESSAGE w002(z001).
error_in_data = 'X'.
endif.
* CHECK: wurde eine gültige Mengeneinheit eingegeben?
when 'EINHEIT_3'.
call method er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = neu_einheit.
call method er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = 'MATERIAL'
IMPORTING
e_value = neu_matnr.
select single meinh from marm
into check_meinh
where matnr = neu_matnr
and meinh = neu_einheit.
if sy-subrc <> 0.
MESSAGE w002(z001).
error_in_data = 'X'.
endif.
if neu_einheit = ' '.
MESSAGE w002(z001).
endif.
endcase.
if ls_good-fieldname <> 'ERFASST' and error_in_data = ' '.
call method er_data_changed->modify_cell
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = 'ERFASST'
i_value = 'C'.
endif.
endloop.
endmethod. "handle_data_changed
endclass. "lcl_event_receiver IMPLEMENTATION
Code: Alles auswählen.
MESSAGE z001 TYPE 'I' NUMBER 002 DISPLAY LIKE 'E'.