When migrating data from a legacy SAP ECC system to a new SAP System, many SAP business objects have documents attached to them via the Generic Object Services (GOS). GOS attachments are stored on the SAP system which can be added/managed from the Generic Object Services (GOS) dropdown menu.

A GOS Attachment Migration involves the below two scenarios,

  • Extraction/Downloading of Attachments from GOS of Legacy System
  • Uploading of Attachments to GOS of Target System

Extraction/Downloading of Attachments from GOS of Legacy System:

The list of attachments attached to the corresponding Business Object can be seen under the dropdown menu of the Transaction Code. The below development functions allow us to implement mass extract/download of all attachment involved in a Business Object into local system.   

For Mass Extraction, execute the below sequence of functions in loop,


This function returns all the document connections attached to the business object.


This function gives us the binary content of the document which will used for further processing. Once you’ve successfully got the attachment details, you should be able to loop over the results table and pass each to the SO_OBJECT_READ function module.

This expects a folder id and a document id which will be in the results of connections return table where they may be concatenated together into one string.


This function is useful for dynamic folder creation for each data and to dump all the documents belonging to that particular data record. (Ex: Folder names with customer number, vendor number, material number).


This function retrieves the document to the specified location. Table SOFFPHIO may act as link table for SCMS_DOC_READ_FILES and Physical ID of the files can be retrieved from SOFFPHIO with the content data from SO_OBJECT_READ.

Uploading of Attachments to GOS:

Loading of documents into GOS of the target system can be achieved by following the below functions in sequence.

For Mass uploading, create an ABAP report or Function involving the below functions.


Imagining that we have extracted bulk documents into the local with unique folder names (say customer number, vendor number, etc). This Function can be used to Read nested folders from local for Mass uploads based on folder names.


The content of the file can be read using this function by passing the individual file path obtained in the above step.


The raw content of the file from the above function needs to be changed to XTRING. This provides us the file content in XTRING format.


Before processing the content, check whether folder ID can be assigned for the purpose of storing the document.


The Xtring content available from the raw content from the Step 3 needs to be processed as BINARY


This function converts the binary content into text for object insert


Finally, the content is written to the document with its original extension and is inserted in the assigned Folder id. At this point your file is already stored somewhere in the depths of SAP Office and the last step is to link this „object ID“ 


After the document is stored in the folder id, the final step is to link the document to the corresponding business object and can be done as below.

Attachments can be seen in the GOS drop down list of the Business Object.

Further Error Handling techniques can be implemented at every step as per the needs.