Requirement : You have the File in the Application Server. You want to place the same in a Content server (which is already configured in your system). Once put in the content server it is attached to the application document which can be accessed through the GOS (Generic Object Services).
How to do:
ASSUME you have already maintained the Document type for the application document's Business Object ( example for PDF/TIF file in the BO BUS2081 )
Assume the content server you have is XX (can be found from the field archiv_id in table TOAOM)
* Fill the comps table parameter
ls_comps-name = -> file name
ls_comps-mimetype = -> mime type can be obtained using the file extension using the FM SDOK_MIMETYPE_GET.
ls_comps-fsize = 0.
ls_comps-compid = 'data'.
APPEND ls_comps TO lt_comps.
The document is picked from the application server and put in content server XX
it generates an archive Id, which is returned back
CALL FUNCTION 'SCMS_HTTP_CREATE_FILES'
EXPORTING
crep_id = 'XX'
path = path -> path of the file in application server, the last '/' should be removed
doc_prot = 'rcud'
frontend = ' '
get_size = 'X'
IMPORTING
doc_id_out = doc_id -> Document Id returned after it is put in Content server
TABLES
comps = lt_comps
EXCEPTIONS
bad_request = 1
unauthorized = 2
forbidden = 3
conflict = 4
internal_server_error = 5
error_http = 6
error_url = 7
error_signature = 8
error_parameter = 9
OTHERS = 10.
* The Application BO and archive Id are linked
CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
EXPORTING
archiv_id = 'XX'
arc_doc_id = doc_id
ar_object = lv_arobj
object_id = -> Application document number (like invoice number, it is the key og BO)
sap_object = -> Business Object
doc_type = -> File extension (PDF / TIF etc ) it can be obtained using CRM_IC_WZ_SPLIT_FILE_EXTENSION
EXCEPTIONS
error_connectiontable = 1
OTHERS = 2.
Once the above is done it will link the Application document to the file in content server.