Copyright 2024 - BV TallVision IT

Does your report use settings that are available on a table for which table maintenance was generated ? Why not bring this table to the selection screen ?

A good selection screen tells a story about what the report (or interface) actually does. You can add functionality via buttons (see other article on this) and you can specifically add SM30 display or change functionality for your report. Use function module VIEW_MAINTENANCE_CALL. A few details by example:

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
  EXPORTING
    action                       = lv_action
    view_name                    = lv_viewname
  TABLES
    excl_cua_funct               = lt_excl_cua_funct
  EXCEPTIONS
    client_reference             = 1
    foreign_lock                 = 2
      ....
    maintenance_prohibited       = 14
    OTHERS                       = 15.

The LV_ACTION is set to 'S' for Show/Display or 'U' for Update mode. The LV_VIEWNAME holds the name of the SM31 view.

Restrict selection

If it's not the whole table you want to provide to the end user, you can pre-select part of your table by simply specifying selection steps. In this example, the field DATASET to be selected should be MY_DATASET:

DATA:  
  gt_sellist type STANDARD TABLE OF VIMSELLIST,
  gw_sellist type VIMSELLIST.

  clear: gt_sellist[].
  gw_sellist-viewfield = 'DATASET'.
  gw_sellist-operator = 'EQ'.
  gw_sellist-value = 'MY_DATASET'.
  append gw_sellist to gt_sellist.
  CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
    EXPORTING
      action    = 'U'
      view_name = 'ZHRI_DATASET'
    TABLES
      dba_sellist = gt_sellist.

The SM30 functionality is triggered and only the entries with DATASET='MY_DATASET' is selected. Of course DATASET is a field on my ZHRI_DATASET table, your table will have it's own fields and values.

Restrict functionality

The LT_EXCL_CUA_FUNCTis an internal table that can hold function codes that you don't want to be available in the editing session. Example:

 APPEND 'AEND' TO LT_EXCL_CUA_FUNCT'.

If the function is called in display (S) mode, adding the AEND function code will ensure the end user can not "change to change mode". Linking your selection screen to relevant table maintenance is adding true quality to your report.

Are you not only linking to a customizing table, but should your report apply updates as well ? Use function mocule VIEW_ENQUEUE to ensure no user is locking the table. It knows no dequeue, so DEQUEUE_ALL to release the locks again.

Large tables - show selection popup

If you want to grant instant access to large tables, the option/ability to enter selection criteria can be made available through parameter SHOW_SELECTION_POPUP which is switched off by default.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
  EXPORTING
    action               = 'U'
    view_name            = 'ZFIAT_IT2002'
    show_selection_popup = 'X'.

The system will present a popup with the fields from the table, exactly like running SM31 with the radio button option "Enter conditions".