Ansicht
Dokumentation

SO_DOCUMENT_LINK_API1 - SAPoffice: Create additional link to document in a folder

SO_DOCUMENT_LINK_API1 - SAPoffice: Create additional link to document in a folder

TXBHW - Original Tax Base Amount in Local Currency   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This function module allows a link to be created for a document in another folder. Links can only be created in the outbox and the private folders of the active user and in the shared folders depending on the authorization involved. Links between the private area of a user and the shared folders are not allowed in either direction.

A distinction needs to be made here between the document and its folder entries. The document itself only exists once in the database. It serves as a template for the folder entries and can be referenced using its object ID. The document can have any number of folder entries. They contain the contents and attributes of the document as well as some additional attributes referring to the folder entry. These include the send priority and the expiration date of the entry. Folder entries are the result of resubmissions, links, and sending and creating a new document.

Import parameters

OLD_DOCUMENT_ID
ID of the folder entry for which a link is to be created. It is the connection 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 the document and the folder in which it is located.

Exceptions

NEW_FOLDER_NOT_EXIST
The specified target folder does not exist. An incorrect ID was probably 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 was probably passed or the folder entry or one of the components involved was deleted.
DOCUMENT_ALREADY_IN_FOLDER
The link could not be created since a corresponding folder entry already exists in the target folder.
OPERATION_NO_AUTHORIZATION
The link could not be created. This may be because an attempt was made to create a link from or to the private folders of another user. An area of the shared folders may also have been referenced, for which the active user does not have the required authorizations.
PARAMETER_ERROR
An invalid combination of parameter values was passed to the function module. An attempt was probably made to create the link in an invalid folder. This includes the inbox, the resubmission folder, the private and shared trash, and the root folder of the shared folders. It is not possible to create links between the private area of a user and that of the 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 be locked. Processing is probably being carried out by another user.

Example

A link is creatd to a newly created folder in the private folders for each document in the outbox of the active user. The IDs required for the outbox and the private folders are determined via the function module SO_USER_READ_API1, the contents of the outbox obtained by SO_FOLDER_READ_API1. To create the new folder, the function module SO_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.

Notes

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 the documentation of the respective function modules.





Parameters

NEW_DOCUMENT_ID
NEW_FOLDER_ID
OLD_DOCUMENT_ID

Exceptions

DOCUMENT_ALREADY_IN_FOLDER
DOCUMENT_NOT_EXIST
ENQUEUE_ERROR
NEW_FOLDER_NOT_EXIST
OPERATION_NO_AUTHORIZATION
PARAMETER_ERROR
X_ERROR

Function Group

SOI1

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 7178 Date: 20240523 Time: 094924     sap01-206 ( 103 ms )