SMAINTENANCE – Automation Of Regular Maintenance Tasks
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”.
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.
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.
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
- Users which are not having security policy assigned are prevented to logon
- Background jobs are not allowed to run during maintenance mode
- All sessions and users are logged off post 10 mins upon activating maintenance mode
- HTTP sessions(webservices) are also closed and users will get 503 error
- 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/
Very Useful and informative Block. Nice one !.
Superb! Thanks for sharing Bhargav
Very informative and useful. Thanks for sharing in detail!
Really helpful, thank you
Very nice and useful .
It seems Tcode SMAINTENANCE is not existing in NW7.50 . We have NW 7.50 SP11 System and it is not existing. do we need to implement any Corrction NOtes for getting this done in NW7.50 or below?
It is available NW 7.52 and above system.
Confirmed, in our NW 7.50 sps20 system it does not exist.
This is available since SAP_BASIS 752
Bhargav Bhatt - Quick question. The help link you referenced doesn't mention this attribute - SERVER_LOGON_PRIVILEGE. It only mentions the other one in your blog. Is this attribute mandatory - SERVER_LOGON_PRIVILEGE. Do you have any reference KBA for this ?