Categories: ABAP Tutorials

4 Alternatives to download files from AL11 in SAP

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

Related Post

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

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

Share
Published by
John

Recent Posts

The Most Important SAP ISU Tables

SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…

December 22, 2020

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd Lecture

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…

November 18, 2020

The Main SAP Dunning Transaction Codes

Dunning is the business practice of informing a customer of past due payment. Dunning letters…

November 28, 2019

SAP Accounts Payable Tcodes & Accounts Receivable Tcodes ( SAP AP Tcodes & SAP AR Tcodes)

SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…

August 1, 2019

The Most Important SAP Payment Terms Tables (ZTERM, Text…)

What are the main SAP Payment Terms Tables ? What are the related Tables in…

October 21, 2018

The most Important SAP Work Center Tables in SAP PP

Work center consists of master data related to routing of products. It contains data related…

October 21, 2018