Suppressing SM02 messages

Suppressing SM02 messages can be needed for specific user ID’s.

Questions that will be answered in this blog are:

  • What are good reasons to suppress SM02 messages for certain users?
  • How to suppress SM02 messages for users on ABAP stack for GUI users?
  • How to suppress SM02 messages for users on ITS webgui?

Reasons to suppress SM02 message

There might be good reasons to suppress SM02 messages for certain users:

  • Robotics users that post and read data via scripts using SAP GUI
  • Monitoring tools that monitor via SAP GUI logon
  • Users on scanner devices that use the ITS webgui

Workaround program for suppression on ABAP stack for GUI users

SM02 has no out of the box option to skip or omit certain users from receiving system messages.

A workaround can be to create a Z program. This Z program has as input a single user or a list of users (it will not allow a range):

Run this program immediately after you set up SM02 message.

The program will simply flag this message as already read. When the user logs on, the system will think it has already sent the SM02 message to the user.

Code:

*&---------------------------------------------------------------------*
*& Report ZSM02SUPPRESS
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zsm02suppress.

DATA: lv_user TYPE sy-uname.
DATA: lv_last_message TYPE temsg-id.
DATA: lv_message_read TYPE temsgu.

SELECT-OPTIONS so_users FOR sy-uname NO INTERVALS.

START-OF-SELECTION.

  SELECT id FROM temsg ORDER BY id DESCENDING INTO @lv_last_message UP TO 1 ROWS.
  ENDSELECT.
  IF sy-subrc EQ 0.
    LOOP AT so_users.
      lv_message_read-mndt = sy-mandt.
      lv_user = so_users-low.
      lv_message_read-bname = lv_user.
      lv_message_read-langu = sy-langu.
      lv_message_read-bdate = sy-datum.
      lv_message_read-bid = lv_last_message.
      UPDATE temsgu FROM lv_message_read.
      WRITE:/ lv_user.
    ENDLOOP.
  ENDIF.

Suppressing messages for ITS webgui

For the ITS webgui, you can use parameter ~WEBGUI_SHOW_SYSTEM_MODAL to suppress the system messages. More background on this blog and this OSS note 1271339 – SAP GUI for HTML: Suppressing system dialogs in integr. ITS.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.