Example: Script for Stopping the R/3 System
@rem echo off
REM
REM substitute following strings:
REM string to subst substitution value typical values
REM <sapsid> SAP R/3 System name, e.g., C11 (case sensitive)
REM <central> your central host's host name
REM <app> your applications server's host name
REM <instance> the instance name, e.g., DVEBMGS00
REM <instance1> the app server's instance name,e.g., D00
REM <no> the central system's SAPSYSTEM, e.g., 00
REM <no1> the app server's SAPSYSTEM, e.g., 01
REM
REM for your values see the definitions in the profiles.
REM all profile names and values including the hostnames are cASeSenSiTivE!!!
REM check the users which will definitely not work
if %USERNAME% == "SYSTEM" goto bad_user
REM first check existence of environment setup file
if not exist <sapsid>env.cmd \\<central>\sapmnt\<sapsid>\sys\exe\run\ntreg2cmd <sapsid>
REM setup the environment for the process so that he is able to
REM run also from poor telnet daemons and Schedule Service
call <sapsid>env.cmd
REM you may want also to shutdown the application server here...
REM if so: repeat the next two lines per app-server to stop them
REM
sapsrvkill <app>_<sapsid>_<no1>REM
sapntwaitforhalt pf=\\<central>\sapmnt\<sapsid>\sys\profile\START_<instance1>_<app> SAPDIAHOST=<app> 120
REM shutdown central instance here...
sapsrvkill <central>_<sapsid>_<no>
sapntwaitforhalt pf=\\<central>\sapmnt\<sapsid>\sys\profile\START_<instance>_<central> SAPDIAHOST=<central> 120
REM you may also want to stop additional application server services here...
REM if so use:
ntscmgr stop SAP<sapsid>_<no1> -m <app>
REM stop central instance service here...
ntscmgr stop SAP<sapsid>_<no> -m <central>
REM DATABASE_SHUTDOWN....
REM for example
sapdba -shutdownsapdba -shutdown
REM SHUTDOWN COMPLETE
goto finito
REM ERROR_HANDLING
:bad_user
echo this batchfile (NTstopR3andDB) will not run under user %USERNAME% >\batcherr.err
echo please configure the Schedule Service to run under <sid>adm >> \batcherr.err
:finito