Download files from AL11 is common requirement for any SAP Consultant. In this guide, you will find different methods to ABAP Download files for Application server to Presentation server (locally).
Download files from AL11 with CG3Y
If you want to write ABAP Download file Report, the SAP Transaction code CG3Y is a fast way to download a large file from AL11 to local directory.
Set the Source File and the Target file on front End and Execute !
There are some extra parameters which can be usefull in same case:
- Transfer format for Data ( by default, it is set to BIN for Binary)
- Overwrite file: is a checkbox if checked will overwrite the destination file if it exists already.
Here a screenshot of the CG3Y (Download File: Parameters)
SAP Copy File with CACS_FILE_COPY ( without ABAP Download)
This Program CACS_FILE_COPY is very usefull also ( can be launched from SE38/SE80).
In fact, the huge advantage of the CACS_FILE_COPY SAP Standard Report is the fact that you use it to Copy SAP File from Application to Presentation Server and Presentation to Application ( in others terms: SAP Server <-> Local ).
Set the Copy direction
- Application To Presentation Server
- Presentation Server to Application
The Set the file source and the file destination paths.
Download as list simple file
If the file is no so long, you can directly download the content in AL11.
Navigate to the file. Then Open the file.
On System Menu, go to List > List > Save > Local File.
In some case, the exported file is truncated.
For List export in AL11, the limit is 512 Characters.
Apply SAP Note 952766 to increase the limit in AL11 ( if your SAP System has the prerequisite for this note)
Usually, I checked the file to be transfered and use this method ( AL11> Save to Local File ) in the first way. It works fine with small file.
Download with ARCHIVFILE_SERVER_TO_CLIENT
The standard Function module ARCHIVFILE_SERVER_TO_CLIENT can also do the work and download file from AL11. ( At lease, check it with SE37 and validate if it is ok for you to use it)
Therfore, you have just to fill :
- PATH: the full path to the file on SAP server
- TARGETPATH: the destination path
Download with a ABAP specific Program
If all the previous solutions are not enough for you or your requirement is more complexed to be done with the above SAP Standard Tools ( tcodes or reports ), in order to download in abap the file, you can ask for/ develop a new ABAP custom Program to download files.
Here SAP offers more powerfull tools to play with files both on Front-End and Back-End.
The main options are:
- ABAP statement OPEN DATASET
- File Functions
- CL_RSAN_UT_* Classes to manage files
ABAP Download: Further ressources
If you want to go further about how to manage Files in SAP with ABAP code or with Standard SAP Tcodes/Reports
- Check also this SAP Tutorial with each option detailed on how to Handle Files on Application Server in SAP.
- You will also find a sample ABAP Code, ready to go, on Sample ABAP Program for Application server File.
- Source: How to download files from AL11 from scn.sap.com