Ansicht
Dokumentation

SO_DOCUMENT_DELETE_API1 - SAPoffice: Delete document using RFC

SO_DOCUMENT_DELETE_API1 - SAPoffice: Delete document using RFC

TXBHW - Original Tax Base Amount in Local Currency   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This function module is used to delete the folder entry of a document. If required, it is placed in the shared trash or private trash of the active user depending on the set of folders and can be retrieved from there before the trash is next emptied.

Import parameters

DOCUMENT_ID
ID of the folder entry to be deleted. It is the connection between the document and folder in which it is located.
UNREAD_DELETE
Default = ' '.
If this flag is set ('X'), the specified folder entry is deleted if it has not yet been read.
PUT_IN_TRASH
Default = 'X'.
If this flag is set ('X'), the deleted entry is placed in the appropriate trash. It can be retrieved from there before the trash is emptied.

Exceptions

DOCUMENT_NOT_EXIST
The specified folder entry does not exist. An incorrect ID was probably passed or the relevent folder entry deleted.
OPERATION_NO_AUTHORIZATION
It was not possible to delete the specified folder entry. This may be because it is located in the private area of another user or in a shared folder for which the active user does not have a delete authorization. Only the SAPoffice administrator can access the shared trash. The document may have been received but not yet read, replied to, or acted upon.
PARAMETER_ERROR
An invalid combination of parameter values was passed to the function module.
X_ERROR
An internal error or database inconsistency occurred.
ENQUEUE_ERROR
A lock involved in the deletion operation could not be set. Processing is probably being carried out by another user.

Example

Deleting all documents which have been read, replied to and acted upon from the inbox of the active user. The deleted documents are placed in the private trash. To determine the ID of the inbox, the function module SO_USER_READ_API1 is used, the list of documents located in the inbox is determined via the function module SO_FOLDER_READ_API1.

DATA: FOL_CONT LIKE SOFOLENTI1 OCCURS 20 WITH HEADER LINE.
DATA: USER_DATA LIKE SOUDATAI1.
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-INBOXFOL
TABLES
FOLDER_CONTENT = FOL_CONT
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC <> 0.
WRITE: / 'Inbox could not be read !'.
EXIT.
ENDIF.
LOOP AT FOL_CONT
WHERE NOT READ IS INITIAL
AND NOT STILL_TODO IS INITIAL
AND ( TO_ANSWER IS INITIAL OR NOT REPLY_SENT IS INITIAL ).
CALL FUNCTION 'SO_FOLDER_DELETE_API1'
EXPORTING
DOCUMENT_ID = FOL_CONT-DOC_ID
PUT_IN_TRASH = 'X'
EXCEPTIONS
OTHERS = 1.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Document', FOL_CONT-OBJ_DESCR, 'was deleted !'.
WHEN OTHERS.
WRITE: / 'Error deleting', FOL_CONT-OBJ_DESCR, '!'.
ENDCASE.
ENDLOOP.
IF SY-SUBRC <> 0.
WRITE: / 'No documents in inbox which can be deleted !'.
ENDIF.

Notes

To delete folders or distribution lists, the function modules SO_FOLDER_DELETE_API1 or SO_DLI_DELETE_API1 must be used.

It is not generally possible to delete documents which have not been viewed, require a reply or need to be acted upon. However, unviewed documents can be removed by setting the UNREAD_DELETE flag, documents which have not yet been replied to for a sender which does not exist in the SAP System.

If a document is deleted from the resubmission folder, all related resubmitted documents are also removed from the inbox.

Further information

Information on calling the function modules SO_USER_READ_API1 and SO_FOLDER_READ_API1 can be found in the documentation of the respective function modules.





Parameters

DOCUMENT_ID
PUT_IN_TRASH
UNREAD_DELETE

Exceptions

DOCUMENT_NOT_EXIST
ENQUEUE_ERROR
OPERATION_NO_AUTHORIZATION
PARAMETER_ERROR
X_ERROR

Function Group

SOI1

Fill RESBD Structure from EBP Component Structure   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 5609 Date: 20240523 Time: 095503     sap01-206 ( 85 ms )