2) 创建表维护
3) 针对上面创建的函数组ZMM_MAT_DESC,做以下增强处理
添加的Module 代码如下:
module mod_customize input.
"自动带出值
zmm_mat_desc-lname = sy-uname.
zmm_mat_desc-ldate = sy-datum.
zmm_mat_desc-ltime = sy-uzeit.
endmodule. " MOD_CUSTOMIZE INPUT
并修改100屏幕,把对应的三个字段设置为不可输入:
4) 创建程序,定义好选择界面,并通过标准函数:VIEW_MAINTENANCE_CALL 调用上面创建的SM30表维护
report zmm_mat_desc no standard page heading.
data: gs_zmm_mat_desc like zmm_mat_desc,
gt_zmm_mat_desc like table of gs_zmm_mat_desc,
gs_vimsellist like vimsellist,
gt_vimsellist like table of gs_vimsellist.
tables zmm_mat_desc.
select-options:
s_matnr for zmm_mat_desc-matnr,
s_maktx for zmm_mat_desc-maktx no intervals,
s_lname for zmm_mat_desc-lname no intervals,
s_ldate for zmm_mat_desc-ldate,
s_ltime for zmm_mat_desc-ltime.
select * into table gt_zmm_mat_desc
from zmm_mat_desc
where matnr in s_matnr
and maktx in s_maktx
and lname in s_lname
and ltime in s_ltime.
loop at gt_zmm_mat_desc into gs_zmm_mat_desc.
gs_vimsellist-viewfield = 'MATNR'.
gs_vimsellist-operator = 'EQ'.
gs_vimsellist-value = gs_zmm_mat_desc-matnr.
gs_vimsellist-and_or = 'OR'.
append gs_vimsellist to gt_vimsellist.
endloop.
call function 'VIEW_MAINTENANCE_CALL'
exporting
action = 'U'
view_name = 'ZMM_MAT_DESC'
tables
dba_sellist = gt_vimsellist
exceptions
client_reference = 1
foreign_lock = 2
invalid_action = 3
no_clientindependent_auth = 4
no_database_function = 5
no_editor_function = 6
no_show_auth = 7
no_tvdir_entry = 8
no_upd_auth = 9
only_show_allowed = 10
system_failure = 11
unknown_field_in_dba_sellist = 12
view_not_found = 13
maintenance_prohibited = 14
others = 15.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif
这是因为指定了选择条件后,添加条目时还要去验证物料是否满足选择条件,显然不符合逻辑;
通过调试发现,需要在上面的Module里面清空掉选择条件限制的标识位,如下:
module mod_customize input.