Sometimes, as a basis guy you will be asking to transport mass transport request sequentially. I can use STMS but because sometime it take long time to wait I want the job do automatically but also want the process stop and send notification automatically when error occurred (RC > 4).
So I create some script. Below is the script, but you can change depend on your need (ex. you need to set different unconditional mode, whether in this example script I use U0).
Don’t forget to set mode of file as executable file (especially for os_addtobuffer and os_stms script file) except for no_tr file and run tp command as <sid>adm. You also need :
- replace <SID> with your SAP System ID, ex. ABC
- replace <SID_of_your_DOMAIN_CONTROLLER> with Domain Controller of your SAP Productive Landscape, ex. CDE
- replace XXX with your SAP Client Number, ex 200
- replace your_email@domain.com with your e-mail
- activate sendmail on your server and make sure you can send message to your e-mail from server
File Number 1 : no_tr
<SID>K000001
<SID>K000002
<SID>K000003
<SID>K000004
<SID>K000005
File Number 2 : os_addtobuffer
for i in `cat no_tr`
do
date
echo $i
tp addtobuffer $i <SID> client=XXX pf=/usr/sap/trans/bin/TP_DOMAIN_<SID_of_your_DOMAIN_CONTROLLER>.PFL >> logbuffer.txt 2>&1
code=$?
if [ $code -gt 4 ]
then
echo "Add buffer TR $i is failed"
exit 1
else
echo "Add buffer TR $i is finished successfully with return code $code"
fi
done
File Number 3 : os_stms
for i in `cat no_tr`
do
date
echo $i
tp import $i <SID> U0 client=XXX pf=/usr/sap/trans/bin/TP_DOMAIN_<SID_of_your_DOMAIN_CONTROLLER>.PFL >> logimport.txt 2>&1
code=$?
if [ $code -gt 4 ]
then
echo "Kindly informed that Transport Request with number $i failed to transport by Return Code=$code, please check this error. Regards" | mailx -s
"Transport $i FAILED with RC = $code, kindly check this!" <your_email@domain.com>
exit 1
else
echo "Importing TR $i is finished successfully with return code = $code"
fi
done
No comments:
Post a Comment