Announcement:
wanna exchange links? contact me at sapchatroom@gmail.com.
Posted by
Admin at
Question from akash on Feb 19 at 1:34 AM As a part of SAP Basis life, we need to import many transports at a time, which is very crucial for the project at the same time its very boring job indeed. Some of us take help of Excel and notepad and create file to import those transports at OS level like separate line for each transport tp import SA8K901203 <SID> client=100 u0126 pf=/usr/sap/trans/bin/TP_DOMAIN_<SID>.PFL tp import SA8K901205 <SID> client=100 u0126 pf=/usr/sap/trans/bin/TP_DOMAIN_<SID>.PFL tp import SA8K901207 <SID> client=100 u0126 pf=/usr/sap/trans/bin/TP_DOMAIN_<SID>.PFL This solves the purpose, but there is no fun in it. Plus lets say if you want that in case of return code 8 or other error the import should stop then above method will not going to help at all. Solution is to create a script for it in Unix. I have done thousands of transport with help of this script on Solaris and Linux, and I don't see any reason why it should not run on other flavors like AIX, HP-UX. Lets proceed to create script file. Create a directory where you like, I created inside trans directory with name TrnScript. Provide read write access to <sid>adm for this directory. Inside this directory you need to create three files. 1. /usr/sap/trans/TrnScript/transport_list.txt file, this file will contain transports list, each transport in new line, which will look like below: $ more transport_list.txt EC6K900076 EH4K930113 EH4K900148 SA8K901203 SA8K901225 SAPKD70243 This is a simple text file and there is no limitation on number of transports you can have a list of thousand transports and they will be processed one by one in linear sequence, the transport in top will be processed first and it will move to second line and so on in downward direction. This file will needs read access rights for <sid>adm. Now we need a executable file to add transports in buffer, it does not matter if the transports are already there in buffer or not, below script is not going to do any harm in system, run it anyway before starting the import script file. 2. /usr/sap/trans/TrnScript/trns_add2buff.sh $ more trns_add2buff.sh # Start of Script file #! This script will add transports to buffer one by one sequentially. # The list of transport should be given in transport_list.txt file where # each transport should be in new line. ### TPLIST=/usr/sap/trans/TrnScript/transport_list.txt TPSTATUS=${TPLIST}.log for i in `cat ${TPLIST}` do /usr/sap/DT9/SYS/exe/uc/linuxx86_64/tp addtobuffer $i DT9 u1 pf=/usr/sap/trans/bin/TP_DOMAIN_DT9.PFL RC=$? print "`date`...Transport ${i} Status RC=${RC}" >> ${TPSTATUS} done # End of script file This file should have executable rights for <sid>adm. Check this file carefully for the path mentioned for (a) TPLIST (b) tp (c) DOMAIN file When above script file will execute, it will create a log file named transport_list.txt.log at same location where transport_list.txt file is present, provided <sid>adm has write access to the directory. The log file will contain information like below $ more transport_list.txt.log Mon Apr 30 06:49:56 CDT 2012...Transport EC6K900076 Status RC=0 Mon Apr 30 06:49:56 CDT 2012...Transport EH4K930113 Status RC=0 Mon Apr 30 06:49:56 CDT 2012...Transport SA8K901225 Status RC=0 This log file will give you chance to check if data file and cofiles are present and readable. Also, if any of the transport is imported in system without option "Leave transport Request in Queue for Later Import" then it will add it again so the request can become transportable again. If you find any other return code than zero then correct the issue rename the log file and rerun this script file again and check log file. If everything goes fine till here then we can go for transport import script file 3. /usr/sap/trans/TrnScript/trns_import.sh $ more trns_import.sh # Start of Script file #! This script will import transports one by one sequentially. # The list of transport should be given in transport_list.txt file where # each transport should be in new line. ### TPLIST=/usr/sap/trans/TrnScript/transport_list.txt TPSTATUS=${TPLIST}.RClog for i in `cat ${TPLIST}` do /usr/sap/DT9/SYS/exe/uc/linuxx86_64/tp import $i DT9 client=100 u0126 pf=/usr/sap/trans/bin/TP_DOMAIN_DT9.PFL RC=$? print "`date`...Transport ${i} Status RC=${RC}" >> ${TPSTATUS} if [ "$RC" -ne 0 ] && [ "$RC" -ne 4 ]; then break fi done # End of script file This script file will import transports with u0126 mode which means 0 - Leave Transport Request in Queue for Later Import 1 - Import Transport Request again 2 - Overwrite Originals 6 - Overwrite Objects in Unconfirmed Repairs Import Option.jpg If you want to select different option then you can adjust accordingly the number appended after "u" in script. This file will create log file transport_list.txt.RClog which will contain the timestamp and RC of each transport. The import of transport will stop when it will get return code other than 0 or 4 Now you can read SAP tp log and resolve the issue then you need to remove those transports which are already imported through script from file transport_list.txt and execute the script again. If you want that in case of error too, the script should move ahead with next transport then you simply need to put # in start of these 3 lines or remove them from the script file if [ "$RC" -ne 0 ] && [ "$RC" -ne 4 ]; then break fi You can also use at now or cron to schedule the script as per your need. Hope this will be of help to some of us. | Reply to this email to post your response. __.____._ | _.____.__ |