Skip to Content
Technical Articles
Author's profile photo Gaurav Pandey

How to download the Content repository (Archive link/Open Text attachments) to App Server or Desktop using ABAP code

Note – This is an example from SAP S/4 HANA – 1809 system but not restricted to a particular release.

Introduction – The SAP Content Server is a stand-alone component in which a large quantity of electronic documents of any format and with any content can be stored. The SAP applications concerned must support the use of the SAP Content Server. The documents can be saved either in one or more MaxDB instances or in the file system. The SAP Content Server is available for Windows 2000 & 2003 Server as well as for several UNIX variants.

Please refer to this SAP help link for more details.

The content repository configuration is maintained via T code OAC0. Please see below example for Accounts Payable (Please note, this article doesn’t focus on the Content repository configuration).

Business Requirement : There are cases when the attachments need to be downloaded from one content server and moved to a different server. For a mass migration of all the attachments , we can get help from server admins and network teams but if we just need to download a select number of attachments (based on attachment types e.g. PDF/JPG or business area e.g. AP/GL/Vendors etc.) writing an ABAP code can be faster and more flexible (e.g. renaming the attachments based on business requirements). Please refer to below technical details:

SAP Table TOA01 stores the details of all the Archive Link attachments.

A typical entry in the table for Accounts Payable looks like below:

The object ID is combination of: COMPANY CODE + DOCUMENT NUMBER + FISCAL YEAR.

Step 1. Use FM: SCMS_DOC_INFO to get the CMS information of the document:

CREP_ID = TOA01-ARCHIV_ID

DOC_ID = TOA01-ARC_DOC_ID

If you see the pop-up below, hit SPACE button and hit ENTER again.

CMS info is returned in the COMPS table:

COMP_ID (in this case ‘data’) returned by the FM is important to proceed to next step.

If the file is PDF or an image (.JPG/.BMP etc.), then COMP_ID is returned as data. If the file is TXT, then COMP_ID is returned as note.

Step 2: Call FM: SCMS_HTTP_GET_FILE with below parameters:

CREP_ID = TOA01-ARCHIV_ID

DOC_ID = TOA01-ARC_DOC_ID

COMP_ID = Value returned above from FM: SCMS_DOC_INFO

PATH = Desktop of app server location, in case of desktop (frontend = X)

Access mode = R (read)

System validates the HTTP connection. If connection is successful, transfer is initiated:

Allow the file download. Download is successful:

File is available on desktop:

 

Conclusion:  I recently used used this technique for a business requirement in my organization. As mentioned, this works like a charm for small set of attachments ( approx. 10K in one shot ), but for a huge volume  , this approach might not be a preferable one.

Assigned tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Karnika Vidyasagar
      Karnika Vidyasagar

      Great Blog!!