Skip to Content
Technical Articles
Author's profile photo Bhargav Bhatt

SMAINTENANCE – Automation Of Regular Maintenance Tasks

Hi All,

Being a SAP Admin you need to frequently deal with various maintenance activities involving application database or operating system. SAP has come up with tcode – SMAINTENANCE to make SAP application ramp down/up activity easy for us.

SMAINTENANCE tcode can be used to monitor and control the status of the system in terms of the so called “Maintenance Mode”.

 

Prerequisite

For using smaintenance t-code we need to create security policy from t-code SECPOL.  Below two attributes are mandatory to use smaintenance t-code

TENANT_RUNLEVEL_LOGON_PRIVILEGE = 1

SERVER_LOGON_PRIVILEGE = 1

 

 

This security policy needs to be assigned to all system Admin users in SU01 which needs to be allowed when system is in maintenance mode

 

 

Below is the screen of t-code smaintenance

 

When we “Switch to Maintenance” only Admin users who are having security policy assigned are allowed to login to system and perform maintenance activity.

Remaining all users including system users are blocked against SAP logon.

Switch to Maintenance

The action “Switch to Maintenance” starts a workflow which sets the system to mode “In Maintenance”. The workflow consists of the modes as described above: “Running -> Web dispatcher closed -> Cool down -> In Maintenance”. The current duration of the whole workflow is 10 minutes.

Switch to Running

The action “Switch to Running” starts a workflow which sets the system to mode “Running”. The workflow consists of the modes “In Maintenance -> Running”. The switch to “Running” is performed immediately.

 

On the top current system status is displayed as show in below

 

There are different modes system goes through:

Running (Runlevel – 0)
The system is fully operational for business end users and administrator. There are no restrictions for services (e.g. batch, rfc, …) or for inbound and outbound connections.

Web dispatcher Closed (Runlevel – 4)
The system is fully operational for business end users and administrators but connections to the Web dispatcher from outside are blocked. That is users connected via the web dispatcher cannot work any longer.

Cool down (Runlevel – 9)
The system is fully operational for administrators only. Business users are expected to finish their work and logout. At the end of the cool down phase business end users’ sessions are terminated.

In Maintenance (Runlevel – 100)
The system is fully operational for administrators only. Administrators are users which have a special security policy assigned. There are no business end users logged onto the system.

Error during mode switch
An error occurred during a system mode switch.

 

 

Below you see the so called “Maintenance Periods” and a “Log” of the maintenance mode.

 

 

Maintenance Periods
The maintenance periods are time periods in which the system is set to Maintenance Mode or where the system is shut down. Maintenance Periods may be defined by external monitoring tools or from within the system by creating a new entry in this view. Only entries created from within the system may be deleted here.

There is no automatic mode switch implemented according to this schedule. By default the schedule of the current year is displayed. Use the selection button to modify this default selection.

 

Log
The log shows messages created by the framework which performs system mode switches. By default the log of the current month is displayed. Use the selection button to modify this default selection.

 

When system is in maintenance mode below things are restricted

  1. Users which are not having security policy assigned are prevented to logon
  2. Background jobs are not allowed to run during maintenance mode
  3. All sessions and users are logged off post 10 mins upon activating maintenance mode
  4. HTTP sessions(webservices) are also closed and users will get 503 error
  5. External interfaces/RFC are restricted to connect SAP system

 

Message end users will see when system in maintenance mode

 

By using this we need not worry about ramp down activities such as users locking/unlocking, Job suspend, system messages, etc during any maintenance related task

 

References link : https://blogs.sap.com/2020/06/18/abap-platform-part-3-whats-new-for-the-basis-administrators/

https://help.sap.com/viewer/e067931e0b0a4b2089f4db327879cd55/202110.000/en-US/79b58c0b017f437aad8f4128980a06a7.html?q=Maintenance%20mode

 

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Karan Bhatt
      Karan Bhatt

      Very Useful and informative Block. Nice one !.

      Author's profile photo Nirav Kundalia
      Nirav Kundalia

      Superb! Thanks for sharing Bhargav

      Author's profile photo Parth Raval
      Parth Raval

      Very informative and useful. Thanks for sharing in detail!

      Author's profile photo Rob Arundel
      Rob Arundel

      Really helpful, thank you

      Author's profile photo A Prasad Rao
      A Prasad Rao

      Very nice and useful .

      Author's profile photo Chetan Sharma
      Chetan Sharma

      Nice Blog!!

      1. Could you please let me know the SAP System Release and Support package Level  Prerequisites for the SMAINTENANCE ?
      2.  Could you please do let me know if the Maintenance Mode on, what will happen for the existing logged on users and running Background Jobs?

      Thanks,

      Chetan Sharna

       

      Author's profile photo Bhargav Bhatt
      Bhargav Bhatt
      Blog Post Author

      Hi Chetan,

       

      1. There is no official statement from which version this was released but Its available with all S4 release also in NW system having release 750 and above
      2. As mentioned in blog users will be given system message as soon as you switch to maintenance mode and post 10 mins they will be logged off, Also as you switch to maintenance mode no new jobs will be allowed to start and running jobs will be allowed to run for 10 mins post which is it terminated.

       

      Regards

      Bhargav Bhatt