For non-SAP documents, Archive-link does what its name suggests: link your .PDF or .DOCx documents to SAP, but store them on an external archive. A brief introduction to this enormous suite of functionality will take you through the concepts.

Manage externally stored documents

As starting point, lets have a look at transaction OAAD - "ArchiveLink Administration Documents" where the documents that are currently "in store" can be selected and viewed. On the first (main) screen of this transaction, there are 2 document counts which indicate the number of documents that are on the Archive(s) as well as the number of print lists that are on the archive(s). If both these numbers are 0, the setup is not used on your (test/development?) system.

Documents and print lists are processed separately.. Documents can be whatever is handed to SAP, Word documents, scanned documents, PDF, XLS, Html, all types of material handed to SAP from some external source. Print lists are effectively spool list output from e.g. an SAP report, which is then stored as a document.

Just to get the look and feel of the archive, select "Store and assign" (effectively transaction OAOH) and create your own archived document on the archives. Fill in PREL as business object and HRONLJWNN as document type which effectively adds a Year-overview of an employee to the system. With the Business Object, the system knows this is about an employee so some employee data will need to be supplied. Fill in the employee number and infotype 0002. Then you will be prompted to supply a .PDF document, which will then be added to the system.

Just in case - you get a warning...

Do you get a message "Repository D3 is not accessible via HTTP" ? D3 is the repository that was chosen for the business object + document type, and it hasn't been set up just yet. Table TOAOM has Business Object and Document type as key, which is where you will find the D3 from the example above. Reverse engineer by selecting an ARCHIV_ID from the TOAAR table and find a suitable TOAOM entry for the ARCHIV_ID. That should get you a suitable business object and document type that will be accepted by your system. Btw the TOAOM-DOC_TYPE field is used to define the document type that is accepted, e.g. PDF (for .PDF) or .FAX (for .RTF and .FAX).

Just in case - you get a warning...

Message "HTTP-error: 401 Unauthorized" is showing ? It's good to know this is not a personal authorization matter, transaction SU53 won't reveal any missed authorization checks. The issue is probably an HTTP matter, where the system needs to be set up first. The mode of transportation of the documents is HTTP, which works with requests. A failed request looks like this:

HTTP/1.0 401 Unauthorized
set-cookie: sap-usercontext=sap-client=100; path=/
content-type: text/html; charset=utf-8
content-length: 2134
sap-system: XXX
www-authenticate: Basic realm="SAP NetWeaver Server [XXX/100]"
server: SAP NetWeaver Application Server / ABAP 732

Effectively the HTTP receiver is not geared up to accept the request...

If your document was added...

Have a play-around. See if you can find the document you've just added and also see if you can get the system to display it - as PDF. 

Add documents - from Abap coding

The archive link setup can be used in a variety of ways. The archive takes care of archiving the document and the actual archiving action can be catered for in your own coding. For this example, I'll use the PREL business object (however: there's around 1000 possible bussiness objects supported).

To add a document to an archive, much like transaction OAOH does, function module ARCHIV_CONNECTION_INSERT can be used. Just as an example setup - for employee documentation:

CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
  EXPORTING
    ARCHIV_ID                   = 'MA'
* A unique key, e.g. generated by SYSTEM_UUID_C_CREATE
    arc_doc_id                  = 'AB236567FDRE'
*   AR_DATE                     = ' '
    ar_object                   = 'HRONLJWNN'
*   DEL_DATE                    = ' '
*   MANDANT                     = ' '
* This is the object key for business object PREL, to
* get it you can use ARCHIV_POPUP_OBJECT_KEY
    object_id                   = '000000120002' 
    sap_object                  = 'PREL'
*    DOC_TYPE                    = 'HRONLJWNN'
*   BARCODE                     = ' '
    FILENAME                    = ' C:\usr\sap\SYS\global\example.PDF'
*   DESCR                       = ' '
*   CREATOR                     = ' '
  EXCEPTIONS
    ERROR_CONNECTIONTABLE       = 1
    OTHERS                      = 2.

Passing the values as constants is not very clever - though for demonstration purpose they tell the tale. A filename of the PDF file is passed, which is a server location. The example is for employee 12 (00000012) infotype 0002 (which is the key to the PREL business object. Try transaction SWO1 for the Business Object you would like to use, to determine how the key is composed.