4 Alternatives to download files from AL11 in SAP

SAP File

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).

We will try to use Standard SAP Transaction Codes, SAP Standard Report, SAP Function module and Custom ABAP Report.

Download files from AL11 with CG3Y

If you want to write ABAP Download file Report, the SAP Transaction codeCG3Y 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 useful 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 CG3Y_Download ALL11 File

SAP Copy File with CACS_FILE_COPY ( without ABAP Download)

This Program CACS_FILE_COPY is very useful 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.

SAP Download Files from ALL11 with CACS_FILE_COPY

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 transferred 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)

Therefore, you have just to fill :

  • PATH: the full path to the file on SAP server
  • TARGETPATH: the destination path
ARCHIVFILE_SERVER_TO_CLIENT

Here the signature of ARCHIVEFILE_SERVER_TO_CLIENT

FUNCTION ARCHIVFILE_SERVER_TO_CLIENT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(PATH) LIKE  SAPB-SAPPFAD
*"     VALUE(TARGETPATH) LIKE  SAPB-SAPPFAD DEFAULT SPACE
*"  EXCEPTIONS
*"      ERROR_FILE
*"      NO_AUTHORIZATION
*"----------------------------------------------------------------------

Note that SAP offers in Standard 3 functions modules:

  • ARCHIVFILE_SERVER_TO_CLIENT
  • ARCHIVFILE_SERVER_TO_SERVER
  • ARCHIVFILE_SERVER_TO_TABLE

Download with a ABAP specific Program

If all the previous solutions are not enough for you or your requirement is more complex 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 powerful 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 resources

If you want to go further about how to manage Files in SAP with ABAP code or with Standard SAP Tcodes/Reports