When you are doing development work or customizing in a SAP system your changes will be written to a transport request. Once the work is finished, the request will be transported to another system (test or production system).
The source and target systems of such a transport route are defined in the SAP system customizing. In case you want to get direct access to a transport file, e.g. to transport modifications to a third system that has not been included in the transport route yet, you need direct access to the file system to copy the transport files manually.
This blog demonstrates a simple way to download released transport requests from an SAP system without accessing the file system directly.
This blog assumes that you have sufficient authorizations to perform the steps specified below.
Make sure the steps are compliant to your company’s organizational and security guidelines!
You have to release the transport request before you are able to download it to your local machine.
1. Know your transport request
First you have to keep in mind the name of the transport request XXXKYYYYYY you want to store (e.g. A07K123456).
2. Find the transfer directory of the SAP system
Releasing a transport request forces the SAP system to store the request in two files on the server: one header (also known as “co-file”) and one body file (also known as “data-file”). To download these files you have to figure out the system specific settings in which directories the files will be written.
Therefore, run transaction AL11 in which the directory parameters can be accessed.
Search for the “Directory Parameter” DIR_TRANS and note the corresponding “Directory” (e.g. [file://myserver/saptrans/|stage:\\myserver\saptrans]).
The header- and the body file are stored in different directories on the server. The next step will show how to figure out their names.
3. Find name and directory of the request header file
A double click on the entry DIR_TRANS in transaction al11 displays the corresponding content.
Beside other entries you will find two sub-directories called “cofiles” and “data”.
First, double click on “cofiles” to enter this directory. Here you should find the header file of your transport request with the following naming syntax: KYYYYYY.XXX (e.g. K123456.A07). You can use Crtl+F to search for it. If you have found your file note the entire directory name (displayed above the table, e.g. file://myserver/saptrans/cofiles) and the file name (e.g. K123456.A07).
4. Find name and directory of the request body file
Return to the DIR_TRANS directory and open the “data” sub-folder. You should find the body file of your transport request in here with the naming syntax: RYYYYYY.XXX (e.g. R123456.A07). Note directory and file name as well.
If you cannot find your files, either the release of the transport request failed or there are other sub-directories defined in your system!
5. Call function module to transfer the files
Now you are able to download the two files from the application server to your local file system. To download the files you can use the standard function module ARCHIVFILE_SERVER_TO_CLIENT. Use se37 to execute the function module.
The function module requires as importing parameters the full qualified paths a) from the source- and b) from the target system including the filename.
To get the header file, the parameters might be:
[stage:Source] PATH: file://myserver/saptrans/cofiles/K123456.A07
And to get the body file the parameters should something like:
[stage:Source] PATH: file://myserver/saptrans/data/R123456.A07
The downloaded files can be used to be imported into another SAP system.
If you have to download transport requests this way very often, the procedure described above is very time-consuming.
So it might be an interesting option to further automate this process.
Below you find the basic idea to create your own program / transaction:.
Prompt for the transport request name and the local directory as input parameters.
Then you can use the statement
CALL ‘C_SAPGPARAM’ ID ‘NAME’ FIELD ‘DIR_TRANS’ ID ‘VALUE’ FIELD lv_dir.
to get the DIR_TRANS directory.
With knowledge about the (static) sub directories as well as the naming syntax of the transport request co- and data-files you can now assemble both server source paths and (in combination with the prompted local directory) the target paths.
Finally call the function module ARCHIVE_SERVER_TO_CLIENT twice (with the assembled source and target paths) to copy the files to the local system.