Introduction
In every SAP system, managing IDocs effectively is crucial—not only for performance but also for long-term data governance. Recently, I worked on IDoc Archival (write & delete only) for a client doing this for the first time. Here’s the complete, detailed process I followed—including handling issues like undeleted IDocs, restricted statuses, and tips on using SARA .
Whether you’re a consultant, admin, or BASIS team member, this guide is designed to help you implement IDoc archival without missing critical steps.
What Is IDoc Archiving?
IDoc (Intermediate Document) archival is the process of transferring IDocs from the SAP database to an archive file and then deleting them from the system to improve performance and reduce storage costs. Archiving ensures compliance with data retention policies while keeping historical data accessible if needed.
Writing eligible IDocs into archive files: Identifies and extracts data that meets archiving criteria, then stores it in archive files for long-term retention.
Deleting those IDocs : After successful archiving, “delete” them from the database, effectively moving them to an external storage system, improving system performance.
This improves DB performance, frees up space, and helps meet compliance rules.
Key Notes Before Starting
IDoc archiving is not just about deletion. You must first archive (write) before you can delete.You must define a path for archive files ( FILE or AL11 ).Get authorization for SARA, WE47, WE09.
Writing the Archive (SARA ➝ Write)
Navigate to transaction code SARA (Archive Administration) and enter the archiving object IDOC.
Choose the “WRITE” function for starting the archiving process.
Create or use an existing variant, as the variant defines the selection criteria and parameters for which IDocs will be archived.
Give a new name for Variant, then click Edit.Select “For All Selection Screen” & Press Continue on the popup dialog box( if appears).Configure the selection criteria: Date Range: Give the date range as required , as given below.
Scroll Down & give Processing option as Production Mode.
For saving a variant: click Attributes > give variant description & save the variant.
Specify the start date and spool parameters: This determines which IDocs will be included in the archive.Execute the archiving process: This will generate archive files containing the selected IDocs (immediate or background).Monitor via SM37—Job Name, e.g., ARV_IDOC_WRITE_…Confirm archive files are created (check in AL11).
Outcome: IDocs are now stored in the archive but still exist in the SAP database.
Note: The program behind this Write step is RSEXARCA.
Deleting Archived IDocs (SARA ➝ Delete)
Back in SARA, Choose the “DELETE” function for removing the archived IDocs from the SAP database.
Select the appropriate archive file created from the write program execution ,it specifies the source of the IDocs to be deleted.
Specify the start date and spool parameters , you can use the same when u executed “WRITE” step.
Execute the deletion process fro the remove of IDocs from the database and leaves them in the archive files.
Monitor job ARV_IDOC_DELETE_.. in SM37.
Done! IDocs are now deleted from the database.
Alternative Method: RSEXARCA and RSEXARCD:
You can also directly run the report RSEXARCA to write IDocs to archive or the report RSEXARCD to delete them from the database.
Problem: IDocs Still Exist After Deletion?
If SE16N shows entries still in EDIDC after deletion, it’s usually due to status restrictions in WE47.
Fix: Handling Restricted IDoc Statuses via WE47
Certain statuses (e.g., error status) are not eligible for deletion unless explicitly allowed.
Check out my post for a detailed explanation of Controlling IDoc Deletion Using WE47: How to Restrict and Unrestrict IDoc Statuses for Archiving
Follow these steps:
Use SE16N to find undeleted IDocs in EDIDC and note their STATUS.
Go to transaction WE47.
Locate the status code (e.g., 64, 51).
Open and adjust the status restriction to allow deletion .
Save your changes.
Re-run both the Write and Delete processes in SARA.
This should now remove those unwanted IDocs.
Check out my post for a detailed explanation of Controlling IDoc Deletion Using WE47: How to Restrict and Unrestrict IDoc Statuses for Archiving
Additional Utilities (Standard Report Programs)
Sometimes you may want more control via report programs:
Conclusion
IDoc archiving is a crucial piece of keeping your SAP system lean and efficient. This guide should help any consultant or admin confidently implement it, even on the first try. If you found this useful or have questions about specific issues, feel free to drop a comment below!
I hope this helps! Let me know your thoughts or if you have any questions.
Thanks,
Akshay Anil
Technical Consultant, SAP ABAP | BTP | Fiori | Ui5
IntroductionIn every SAP system, managing IDocs effectively is crucial—not only for performance but also for long-term data governance. Recently, I worked on IDoc Archival (write & delete only) for a client doing this for the first time. Here’s the complete, detailed process I followed—including handling issues like undeleted IDocs, restricted statuses, and tips on using SARA .Whether you’re a consultant, admin, or BASIS team member, this guide is designed to help you implement IDoc archival without missing critical steps.What Is IDoc Archiving?IDoc (Intermediate Document) archival is the process of transferring IDocs from the SAP database to an archive file and then deleting them from the system to improve performance and reduce storage costs. Archiving ensures compliance with data retention policies while keeping historical data accessible if needed.Writing eligible IDocs into archive files: Identifies and extracts data that meets archiving criteria, then stores it in archive files for long-term retention.Deleting those IDocs : After successful archiving, “delete” them from the database, effectively moving them to an external storage system, improving system performance.This improves DB performance, frees up space, and helps meet compliance rules. Key Notes Before StartingIDoc archiving is not just about deletion. You must first archive (write) before you can delete.You must define a path for archive files ( FILE or AL11 ).Get authorization for SARA, WE47, WE09. Writing the Archive (SARA ➝ Write)Navigate to transaction code SARA (Archive Administration) and enter the archiving object IDOC.Choose the “WRITE” function for starting the archiving process.Create or use an existing variant, as the variant defines the selection criteria and parameters for which IDocs will be archived.Give a new name for Variant, then click Edit.Select “For All Selection Screen” & Press Continue on the popup dialog box( if appears).Configure the selection criteria: Date Range: Give the date range as required , as given below.Scroll Down & give Processing option as Production Mode.For saving a variant: click Attributes > give variant description & save the variant.Specify the start date and spool parameters: This determines which IDocs will be included in the archive.Execute the archiving process: This will generate archive files containing the selected IDocs (immediate or background).Monitor via SM37—Job Name, e.g., ARV_IDOC_WRITE_…Confirm archive files are created (check in AL11).Outcome: IDocs are now stored in the archive but still exist in the SAP database.Note: The program behind this Write step is RSEXARCA. Deleting Archived IDocs (SARA ➝ Delete)Back in SARA, Choose the “DELETE” function for removing the archived IDocs from the SAP database.Select the appropriate archive file created from the write program execution ,it specifies the source of the IDocs to be deleted.Specify the start date and spool parameters , you can use the same when u executed “WRITE” step.Execute the deletion process fro the remove of IDocs from the database and leaves them in the archive files. Monitor job ARV_IDOC_DELETE_.. in SM37.Done! IDocs are now deleted from the database. Alternative Method: RSEXARCA and RSEXARCD:You can also directly run the report RSEXARCA to write IDocs to archive or the report RSEXARCD to delete them from the database. Problem: IDocs Still Exist After Deletion?If SE16N shows entries still in EDIDC after deletion, it’s usually due to status restrictions in WE47.Fix: Handling Restricted IDoc Statuses via WE47Certain statuses (e.g., error status) are not eligible for deletion unless explicitly allowed.Check out my post for a detailed explanation of Controlling IDoc Deletion Using WE47: How to Restrict and Unrestrict IDoc Statuses for Archiving Follow these steps:Use SE16N to find undeleted IDocs in EDIDC and note their STATUS.Go to transaction WE47.Locate the status code (e.g., 64, 51).Open and adjust the status restriction to allow deletion .Save your changes.Re-run both the Write and Delete processes in SARA.This should now remove those unwanted IDocs.Check out my post for a detailed explanation of Controlling IDoc Deletion Using WE47: How to Restrict and Unrestrict IDoc Statuses for Archiving Additional Utilities (Standard Report Programs)Sometimes you may want more control via report programs: Report Program Purpose RSEXARCAArchive IDocsRSEXARCDDelete archived IDocsRSEXARCRRead archive fileRSEXARCLReload IDocs from archive ConclusionIDoc archiving is a crucial piece of keeping your SAP system lean and efficient. This guide should help any consultant or admin confidently implement it, even on the first try. If you found this useful or have questions about specific issues, feel free to drop a comment below!I hope this helps! Let me know your thoughts or if you have any questions.Thanks,Akshay Anil Technical Consultant, SAP ABAP | BTP | Fiori | Ui5 Read More Technology Blog Posts by Members articles
#SAP
#SAPTechnologyblog