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.

SM02 system messages

Transaction SM02 can be used to broadcast important messages to every user. This can be used in case of emergencies or for sending important messages to every users.

Questions that will be answered in this blog are:

  • How to set up a system wide message?
  • How to delete system messages?

Set up system message

Start transaction SM02 to set up a system message:

Press create to set up a new system message:

Text is limited to Twitter style: 3 rows of 60 characters.

Result is that each user gets a popup:

Suppressing messages for certain users

To suppress messages for certain users an ABAP trick is needed. Read more in this blog.

Technical background of SM02

SM02 messages are stored in 3 tables:

  • TEMSI for the message ID
  • TEMSG for the message text
  • TEMSGU to store last message read by user ID and logon.

Program RSM02INIT can be used to delete all SM02 content (see OSS note 1179456 – SM02: Resetting tables for system messages).

Or you can delete one by one in SM02, or simply wait for the retention period.