SAP Function SO_FOLDER_DELETE_API1 - SAPoffice: Delete folder from external location

Parameter Reference Type Length Default Optional Text
FOLDER_ID SOOBJINFI1-OBJECT_ID C 17 ID of folder to be deleted
FORCE_ENTRIES_DELETE SONV-FLAG C 1 X Flag: Documents in folder will be deleted
PUT_IN_TRASH SONV-FLAG C 1 'X' X Flag: Move folder to trash when deleted

Exception Text
ENQUEUE_ERROR Required locks could not be set
FOLDER_NOT_EMPTY Specified folder was not empty
FOLDER_NOT_EXIST Specified folder does not exist
FOLDER_NO_AUTHORIZATION No authorization to delete folder
PARAMETER_ERROR Invalid combination of parameter values
X_ERROR Internal error or database inconsistency

Functionality
This function module allows a folder and the documents and sub-foldersit may contain to be deleted. If necessary, all deleted objects areeither placed in the shared trash or private trash of the active user,depending on the folder structure involved, and can be retrieved fromthere before the trash is next emptied.

Import parameters
FOLDER_ID
Object ID of the folder to be deleted.
PUT_IN_TRASH
Default = 'X'.
If this flag is set ('X'), the deleted objects are placed in theappropriate trash. They can be retrieved from there before the trash isnext emptied.
FORCE_ENTRIES_DELETE
Default = ' '.
If this flag is set ('X'), all documents and sub-folders contained inthe specified folder are also deleted. If the flag is not set and thefolder to be deleted is not empty, the exception FOLDER_NOT_EMPTY israised.

Exceptions
FOLDER_NOT_EMPTY
The folder could not be deleted because it still contains documents. Ifthis exception is raised even when the FORCE_ENTRIES_DELETE flag isset, a document could not be deleted in the folder or one of itssubfolders.
FOLDER_NOT_EXIST
The specified folder does not exist. An incorrect ID was probablypassed or the relevant folder deleted.
FOLDER_NO_AUTHORIZATION
The specified folder could not be deleted. This may be because it isanother user's private folder or because it is a shared folder forwhich the user does not have a delete authorization. Only the SAPofficeadministrator can access the shared trash.
PARAMETER_ERROR
An invalid combination of parameter values was passed to the functionmodule.
X_ERROR
An internal error or a database inconsistency occurred.
ENQUEUE_ERROR
A folder or related document involved in the delete operation could notbe locked. It is probably being processed by another user.

Example
Deleting a folder with documents it may contain. All deleted objectsare placed in the trash. The ID of the folder to be deleted must beentered by the active user.
PARAMETERS FOLDER_ID LIKE SOOBJINFI1-OBJECT_ID.
CALL FUNCTION SO_FOLDER_DELETE_API1
EXPORTING
FOLDER_ID = FOLDER_ID
PUT_IN_TRASH = 'X'
FORCE_ENTRIES_DELETE = 'X'
EXCEPTIONS
FOLDER_NOT_EXIST = 2
FOLDER_NO_AUTHORIZATION = 3
ENQUEUE_ERROR = 6
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Folder deleted !'.
WHEN 2.
WRITE: / 'Specified folder does not exist !'.
WHEN 3.
WRITE: / 'No authorization to delete the specified folder !'.
WHEN 6.
WRITE: / 'Folder is being processed !'.
WHEN 99.
WRITE: / 'Error occurred deleting the folder !'.
ENDCASE.

Notes
To delete documents and distribution lists, the function modulesSO_DOCUMENT_DELETE_API1 or SO_DLI_DELETE_API1 must be used.