Functionality This function module allows a link to be created for a document inanother folder. Links can only be created in the outbox and the privatefolders of the active user and in the shared folders depending on theauthorization involved. Links between the private area of a user andthe shared folders are not allowed in either direction. A distinction needs to be made here between the document and its folderentries. The document itself only exists once in the database. Itserves as a template for the folder entries and can be referenced usingits object ID. The document can have any number of folder entries. Theycontain the contents and attributes of the document as well as someadditional attributes referring to the folder entry. These include thesend priority and the expiration date of the entry. Folder entries arethe result of resubmissions, links, and sending and creating a newdocument. Import parameters OLD_DOCUMENT_ID ID of the folder entry for which a link is to be created. It is theconnection between the document and the folder in which it is located. NEW_FOLDER_ID Object ID of the folder in which the link is to be created. Export parameters NEW_DOCUMENT_ID ID of the newly created folder entry. It is the connection between thedocument and the folder in which it is located. Exceptions NEW_FOLDER_NOT_EXIST The specified target folder does not exist. An incorrect ID wasprobably passed or the relevant folder deleted. DOCUMENT_NOT_EXIST The specified folder entry or one of objects connected to the ID(folder, document, or forwarder) does not exist. An incorrect ID wasprobably passed or the folder entry or one of the components involvedwas deleted. DOCUMENT_ALREADY_IN_FOLDER The link could not be created since a corresponding folder entryalready exists in the target folder. OPERATION_NO_AUTHORIZATION The link could not be created. This may be because an attempt was madeto create a link from or to the private folders of another user. An areaof the shared folders may also have been referenced, for which theactive user does not have the required authorizations. PARAMETER_ERROR An invalid combination of parameter values was passed to the functionmodule. An attempt was probably made to create the link in an invalidfolder. This includes the inbox, the resubmission folder, the privateand shared trash, and the root folder of the shared folders. It is notpossible to create links between the private area of a user and that ofthe shared folders in either direction. X_ERROR An internal error or a database inconsistency occurred. ENQUEUE_ERROR The folder entry, the related folder, or the target folder could not belocked. Processing is probably being carried out by another user. Example A link is creatd to a newly created folder in the private folders foreach document in the outbox of the active user. The IDs required forthe outbox and the private folders are determined via the functionmodule SO_USER_READ_API1, the contents of the outbox obtained bySO_FOLDER_READ_API1. To create the new folder, the function moduleSO_FOLDER_INSERT_API1 is used. DATA: FOL_CONT LIKE SOFOLENTI1 OCCURS 20 WITH HEADER LINE. DATA: USER_DATA LIKE SOUDATAI1. DATA: FOL_CHNG LIKE SOFOLCHGI1. DATA: FOLDER_ID LIKE SOFOLDATI1-OBJECT_ID. CALL FUNCTION 'SO_USER_READ_API1' IMPORTING USER_DATA = USER_DATA EXCEPTIONS OTHERS = 1. IF SY-SUBRC <> 0. WRITE: / 'User data could not be read !'. EXIT. ENDIF. CALL FUNCTION 'SO_FOLDER_READ_API1' EXPORTING FOLDER_ID = USER_DATA-OUTBOXFOL TABLES FOLDER_CONTENT = FOL_CONT EXCEPTIONS OTHERS = 1. IF SY-SUBRC <> 0. WRITE: / 'Outbox could not be read !'. EXIT. ENDIF. FOL_CHNG-OBJ_NAME = 'VERWEISE'. FOL_CHNG-OBJ_DESCR = 'Links from the outbox'. FOL_CHNG-OBJ_LANGU = SY-LANGU. FOL_CHNG-SENSITIVTY = 'O'. FOL_CHNG-FOLSECTION = 'P'. CALL FUNCTION 'SO_FOLDER_INSERT_API1' EXPORTING PARENT_FOLDER_ID = USER_DATA-PRIVATFOL FOLDER_INSERT_DATA = FOL_CHNG IMPORTING FOLDER_ID = FOLDER_ID EXCEPTIONS OTHERS = 1. IF SY-SUBRC <> 0. WRITE: / 'The folder for the links could not be created !'. EXIT. ENDIF. LOOP AT FOL_CONT. CALL FUNCTION 'SO_DOCUMENT_LINK_API1' EXPORTING OLD_DOCUMENT_ID = FOL_CONT-DOC_ID NEW_FOLDER_ID = FOLDER_ID EXCEPTIONS OTHERS = 1. IF SY-SUBRC <> 0. WRITE: / 'Link for', FOL_CONT-OBJ_DESCR, 'could not be created !'. ELSE. WRITE: / 'Link for', FOL_CONT-OBJ_DESCR, 'was created !'. ENDIF. ENDLOOP. Further information Information on calling the function modules SO_USER_READ_API1,SO_FOLDER_READ_API1 and SO_FOLDER_INSERT_API1 can be found in thedocumentation of the respective function modules. |