The purpose - limit SM30 records
Many times automatically generated maintenance view does not fully fit our requirements although this is very nice and useful feature. This article is focused on limitation of SM30 maintenance view data and a way how to protect certain rows. Imagine, user is a member of some certain plant/werks and he does not need to see or even modify records of different plant/werks.The way - create tiny program
In this case just simply create small program as it is shown by below example. The trick is to put pre-filled select option data for maintenance view called as a parameter of function module "VIEW_MAINTENANCE_CALL".Below example will reduce rows to be loaded into SM30 editor by plant. In this case only plants 9901 or 9902 would be read, nothing else. Of course the plant values should be taken from somewhere else and not be hard coded! :-)
The code sample
REPORT /somenamespace/hu_custom_view.DATA: lt_seltab TYPE STANDARD TABLE OF vimsellist,
ls_seltab LIKE LINE OF lt_seltab.
ls_seltab-viewfield = 'WERKS'.
ls_seltab-operator = 'EQ'.
ls_seltab-and_or = 'OR'.
ls_seltab-value = '9901'.
APPEND ls_seltab TO lt_seltab.
CLEAR ls_seltab.
ls_seltab-viewfield = 'WERKS'.
ls_seltab-operator = 'EQ'.
ls_seltab-and_or = 'OR'.
ls_seltab-value = '9902'.
APPEND ls_seltab TO lt_seltab.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL' " SM30
EXPORTING
action = 'U' " update action
view_name = '/SomeNameSpace/hu_custom_view01' " view name (input of SM30)
show_selection_popup = abap_false
TABLES
dba_sellist = lt_seltab.