Download Files from ArchiveLink


Notice: A non well formed numeric value encountered in /home/thefoo20/public_html/SAPIntegrationHub.com/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/thefoo20/public_html/SAPIntegrationHub.com/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /home/thefoo20/public_html/SAPIntegrationHub.com/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/thefoo20/public_html/SAPIntegrationHub.com/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Let’s look at how to access files stored in ArchiveLink and download them to the desktop. In the linked article, we discussed a way to write files to the SAP archive server. In this article, we will develop an ABAP program to read files from the archive server. First, we will look into the Function Modules (FM) needed to read files from ArchiveLink, then we will use those FMs to implement ABAP report that reads a given file from the archive content server and downloads it to the desktop.

List of archived documents of a sap business object shown in GOS tool box.
Archived attachment of SAP business document – Generic Object Service

The screenshot above shows a PDF attachment that was archived by our custom ABAP program. In this article, we will learn how to programmatically retrieve the archived document from ArchiveLink.

Users can access the archived attachments using the Generic Object Service (GOS) toolbox of the business object.

This ABAP program accepts certain parameters related to the ArchiveLink document and downloads the file from the archive repository to the desktop. You can reuse the program to read any type of archived attachment from SAP business documents, such as purchase orders, invoices, sales orders, deliveries, etc.

If your requirement is to download the file to AL11, FTP, or convert the file content to base64, you can appropriate FMs instead of the GUI_DOWNLOAD. The rest of the ABAP processing steps to read attachments and files from ArchiveLink I have listed down will remain more or less the same.

Selection Screen

Selection screen of the ArchiveLink read program.
Selection screen of the ABAP Program

In our program, we have three main parameters related to ArchiveLink:

  1. SAP business object. Business object type of the SAP document, for example, VBRK for invoice, EKKO for purchase order, LIKP for delivery, VBAK for sales order, etc. To find a full list of business object types go to table TOJTB (Business object repository).
  2. ArchiveLink document type. For easier and logical segregation of files stored in the archive server, they are categorized into document types. Catagorization depends on your business requirment. This parameter correspons to field “AR_OBJECT” of table TOAOM (SAP ArchiveLink: Meta table for links).
  3. SAP document number. The document number of the business document which can be an invoice number, sales order number, purchase order number, etc. However, the document number should be a valid document number under the SAP business object of the first parameter.
  4. Archive document ID. ArchiveLink assigns a unique GUID for each and every document archived. Archive document ID is the unique identifier of each archived document. This parameter is related to field “ARC_DOC_ID” of link tables TOA01, TOA02 or TOA03.
Processing steps of the ABAP program that read data from archive server.
ArchiveLink read ABAP processing steps

Step 1: As the first step, we will identify the ArchiveLink content repository ID based on the selection screen parameters, SAP business object, and archive document type. Pass the archive document type and sap business object type to FM ARCHIV_METAINFO_GET in order to find the archive server ID.


To view the full list of ArchiveLink repositories used for different SAP objects, go to transaction OAC3.


Step 2: The next step is to find out the list of file attachments archived under the SAP document. Use the FM ARCHIV_GET_CONNECTIONS to get a list of archived documents under the business document. The link between the business document and the archived document is known as ArchiveLink connection.

SAP link tables TOA01, TOA02, or TOA03 hold the full list of connections of each document.

In this example, we will read the first attachment from the list of archived attachments or use the archive document ID from the selection screen for further processing.

Step 3: Now that we have found out the archive document information from the previous step, let’s use the FM ARCHIVOBJECT_GET_TABLE to read the archived file from the content server. We will extract the file content in RAW 1024 format.

Step 4: Download the PDF to the desktop using GUI_DOWNLOAD.


Main program

ABAP Include


To summarize, we’ve looked at the design of the ABAP program that reads files such as PDFs, TXT files, and images from ArchiveLink. Then, we’ve analyzed the FMs needed to read content from the archive repository. Finally, we have coded the ABAP program.

If you have questions or comments regarding ArchiveLink, please leave a message below.

TECH GADGETS I USE EVERY DAY

These are some of the tech gadgets I use every day. If you make a purchase through these links I will earn a small comission at absolutely no extra cost to you.

Leave a Reply

Your email address will not be published. Required fields are marked *