使用VIEW_MAINTENANCE_CALL維護tableview

qiujun發表於2007-10-05

REPORT ztest.
TABLES t001b.
TYPES:
BEGIN OF ty_mkoar,
mkoar TYPE mkoar,
END OF ty_mkoar.

DATA: it_vimsellist TYPE TABLE OF vimsellist,
iw_vimsellist TYPE vimsellist,
it_vimexclfun TYPE TABLE OF vimexclfun,
iw_vimexclfun TYPE vimexclfun.
DATA: it_mkoar TYPE TABLE OF ty_mkoar,
iw_mkoar TYPE ty_mkoar.
DATA: w_flg TYPE c.

PARAMETERS p_bukrs TYPE t001b-bukrs.

SELECT-OPTIONS: s_mkoar FOR t001b-mkoar.

START-OF-SELECTION.

SELECT mkoar
INTO CORRESPONDING FIELDS OF TABLE it_mkoar
FROM t001b
WHERE mkoar IN s_mkoar.

*編輯過濾資料條件
iw_vimsellist-viewfield = 'BUKRS'.
iw_vimsellist-operator = 'EQ'.
iw_vimsellist-and_or = 'AND'.
iw_vimsellist-value = p_bukrs.
APPEND iw_vimsellist TO it_vimsellist.

LOOP AT it_mkoar INTO iw_mkoar.
iw_vimsellist-viewfield = 'MKOAR'.
iw_vimsellist-operator = 'EQ'.
iw_vimsellist-and_or = 'OR'.
iw_vimsellist-value = iw_mkoar-mkoar.
APPEND iw_vimsellist TO it_vimsellist.
CLEAR iw_mkoar.
ENDLOOP.
*遮蔽按鈕(按T-CODE)
iw_vimexclfun-function = 'NEWL'.
APPEND iw_vimexclfun TO it_vimexclfun.
iw_vimexclfun-function = 'KOPE'.
APPEND iw_vimexclfun TO it_vimexclfun.
iw_vimexclfun-function = 'DELE'.
APPEND iw_vimexclfun TO it_vimexclfun.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'U'
view_name = 'V_T001B'
TABLES
dba_sellist = it_vimsellist
excl_cua_funct = it_vimexclfun
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.

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90072/viewspace-974772/,如需轉載,請註明出處,否則將追究法律責任。

相關文章