Working with IDocs
An IDoc (Intermediate Document) is the central import and export format of an SAP ERP system. By using IDocs, you can export and import any type of data from an SAP system. In addition to the pre-defined IDoc formats, such as ORDERS, ORDRSP, DESADV, etc, you can also define your own IDoc formats.
In the SAP system, transaction BD87 is a useful tool for the administration of IDocs. Ideally, all IDocs have a green or yellow status in transaction BD87.
The following screenshot shows transaction BD87 in a test system. As you can see, some IDocs are in an error status. The status below would not be acceptable in a production system, as it would mean that important data would potentially not leave the system or were not received by it.
There are two options to correct the red status in a production system. Either the IDoc can be edited and processed again, or the faulty IDoc can be deleted and the data regenerated. For outbound IDocs this means that the generating process in SAP needs to be started again (e.g., retriggering of DESADV IDoc generation using new LALE message entry). However, for inbound documents, this means that the data needs to be sent to the SAP system again, e.g., from the EDI system.
But first you want to delete the old IDoc, to keep a clean transaction BD87.
There are two options to delete an IDoc.
The first option is to change the IDoc status, e.g. reset it to status 31 (error, no more processing) or to status 38 (IDoc archived). The IDoc is not physically deleted, but the status is reset, so that the IDoc does not stay in a defective status in transaction BD87.
The other option is to physically delete the IDoc. SAP provides transaction WE11 for this purpose, as shown in the Figure below.
Similar to transaction BD87, you can select IDocs using several different parameters. Just as with transaction BD87, it is highly recommended to use extreme caution when using transaction WE11, as you could accidentally delete many IDocs. Fortunately, after clicking on execute (alternatively pressing F8), transaction WE11 will issue a confirmation prompt, as shown in the following screenshot.
If you are not sure, you can alternatively start a test run instead of deleting. In this case, the deletion is only simulated, and you can see how many IDocs would be deleted. Since deleting is a potentially irreversible action, one should be very careful about what exactly is selected for deletion.
After the deletion, an overview of the deleted artifacts will be displayed.
Which of the two methods is used to delete an IDoc depends primarily on the compliance rules of the respective company. For example, transaction WE11 may be deactivated in the production system because, for audit reasons, you want to prevent something from being removed from SAP. Furthermore, access to transaction WE11 may only be possible for a small group of users (e.g., EDI administrators), as one would like to prevent the business units from accidentally cleaning up the system.