Export Database Tables Using R3trans Command in SAP
The R3trans tool is used in SAP for exporting and importing database tables at a low
level. It is often used for system copies, data migration, troubleshooting, and backup
purposes.
🔹 Steps to Export SAP Database Tables Using R3trans
To export SAP database tables using R3trans, follow these steps:
✅ Step 1: Log in to the SAP Application Server
1. Connect to your SAP system as the <sid>adm user.
2. Open a terminal or SSH session.
✅ Step 2: Create the Control File (export_table.ctrl)
This file tells R3trans which tables to export.
1. Navigate to the SAP trans directory:
cd /usr/sap/trans
2. Create a control file:
nano export_table.ctrl
3. Add the following content to specify which tables to export:
export
file = export_table.dat
select * from <TABLE_NAME>
Example (exporting T001, MARA tables):
export
file = export_table.dat
select * from T001
select * from MARA
4. Save the file (Ctrl + X, then Y, then Enter`).
✅ Step 3: Run the R3trans Export Command
Now, execute the export process:
R3trans -w export_table.log export_table.ctrl
• -w export_table.log → Writes the log output.
• export_table.ctrl → Uses this control file to define what to export.
✅ Once completed, the exported data will be stored in export_table.dat.
✅ Step 4: Verify the Export
Check the log file to confirm if the export was successful:
cat export_table.log
Look for:
R3trans finished (0000)
🔹 If you see 0000, the export was successful.
🔹 If you see 0008 or 0012, there was an error—check the log for details.
🔹 How to Import the Exported Tables (Optional)
If you need to import the exported data into another SAP system:
1. Copy the exported file (export_table.dat) to the target system.
2. Create an import control file (import_table.ctrl):
nano import_table.ctrl
3. Add the following:
import
file = export_table.dat
4. Run the import command:
R3trans -w import_table.log import_table.ctrl
5. Check the log file:
cat import_table.log
✅ Successful import message: R3trans finished (0000)
🔹 Summary of R3trans Export/Import Process
Action Command
Create export control file nano export_table.ctrl
Run export R3trans -w export_table.log export_table.ctrl
Verify export log cat export_table.log
Transfer exported file to another system scp export_table.dat user@target:/usr/sap/trans/
Create import control file nano import_table.ctrl
Run import R3trans -w import_table.log import_table.ctrl
Check import log cat import_table.log
🎯 Conclusion
• R3trans is a powerful SAP tool for exporting and importing database tables.
• The control file (.ctrl) defines the tables and options.
• The log file (.log) shows the success or failure of the process.
• Use SCP or FTP to transfer data between systems.
Would you like a script to automate table exports? 🚀