函数VIEW_MAINTENANCE_CALL虽然也可以跳转至SM30,但仍然需要分配必要的表权限和SM30权限才可以使用,否则会报没有权限的异常
进入函数源码当中可以发现,开头有一节关于权限校验的代码,脑动分析一下把关键代码摘取出来的同时去掉权限校验,最后得到下面的代码,最后实现了无需sm30权限即可调用该函数的效果
REPORT zdemo_seele.
DATA:gt_dba_sellist TYPE TABLE OF vimsellist,
gt_excl_cua_funct TYPE TABLE OF vimexclfun,
gt_x_header TYPE TABLE OF vimdesc,
gt_x_namtab TYPE TABLE OF vimnamtab,
gt_dpl_sellist TYPE TABLE OF vimsellist.
DATA:lockuser TYPE sy-uname,
answer(1) TYPE c.
CALL FUNCTION 'VIEW_GET_DDIC_INFO'
EXPORTING
viewname = 'ZMMT101'
TABLES
sellist = gt_dba_sellist
x_header = gt_x_header
x_namtab = gt_x_namtab
EXCEPTIONS
no_tvdir_entry = 1
table_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'VIEW_ENQUEUE'
EXPORTING
view_name = 'ZMMT101'
action = 'E'
enqueue_mode = 'E'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
table_not_found = 5
client_reference = 7.
IF sy-subrc NE 0.
MESSAGE 'Data locked' TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDIF.
CALL FUNCTION 'VIEW_MAINTENANCE'
EXPORTING
view_action = 'U'
view_name = 'ZMMT101'
TABLES
dba_sellist = gt_dba_sellist
excl_cua_funct = gt_excl_cua_funct
x_header = gt_x_header
x_namtab = gt_x_namtab
EXCEPTIONS
missing_corr_number = 1
no_database_function = 2
no_editor_function = 3
no_value_for_subset_ident = 4
OTHERS = 5.
CALL FUNCTION 'VIEW_ENQUEUE'
EXPORTING
view_name = 'ZMMT101'
action = 'D'
enqueue_mode = 'E'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
table_not_found = 5
client_reference = 7.