SAP Data Archiving – MM_SPSTOCK (Archiving Batch Master Records)
SAP ECC6 – Data Archive. For more information, visit the Data Management and Integration homepage
This document helps people to understand the usage of archiving. It consists of step-by-step process of
Archiving Special Stock Records such as records for Batches and consignment Materials
Usage of SAP for our Day to Day Business Activities Results in Huge Amount of Enterprise Data.
It consequences are Data Overflow, Transactions running for long time and Performance Degradation. By
using Data Archiving Methodology we can clean up the Out of date data or any unused data and store it
offline. This leads to Performance improvement, Maximized System availability, Reduction of costs.
SAP provides us a solution for this Data Archiving process using which we can archive the data in a secure
and consistent manner. Archiving program uses certain checks and follows certain rules which ensure
consistency of data. By using this method we can archive master data such as Material Master, Batch
Master Records, HR master data and transactional data such as Sales Documents, Financial Documents,
Purchase orders etc.
Archiving process comprises of two mandatory steps
· Archive File Creation
· Deletion of files from the Database
These steps are discussed in detail for Batch Records and Consignment Materials
Archiving Configuration Setup
The first step of Configuration of Archiving Object starts from transaction AOBJ. Batches and Consignment
materials are archived via the object MM_SPTOCK
You can also see the list of tables from which data is going to be archived. The Transaction DB15 can be
used for this purpose
Note: For Performing theWrite Step You should have required authorizations for executing SARA Transaction
How to Choose Data which is Eligible for Archiving
Generally in any SAP System Transaction Data forms the major part and it occupies huge space. Master
Data is changed rarely and it occupies lesser space compared to transactional data.
Data Archiving is used for both transactional and master data
In this case the data is Batch Master Records. Whenever your customer no longer needs the data you can
archive and delete that. For this to happen you have to flag that particular batch master which customer no
longer needs so that the archiving and deletion program will delete it.
When a batch master record is created, the deletion flag is hidden if the material master record is not flagged
for deletion at plant level or storage location level. If the material master record is flagged for deletion, the
system issues a warning on the initial screen. The Deletion flag field is then displayed, but the deletion flag
cannot be set. You can set the deletion flag at plant level for a Batch master Record using Transaction
Archiving File Creation- Write Step
Open the Transaction SARA and Specify MM_SPSTOCK as the Archiving Object
Click on the Write Button.
Give the Variant name and Select Maintain Button
You can check the job log and spool using SM37 once the job is completed successfully
After successful completion of the write step next comes the delete step where the data being written on the
file is deleted using the delete program
Now press the Delete button. Once you click on it you will be redirected to screen shown below
Press the archive selection button and you will get a Pop-up display which shows you the completed write
You can see all the traffic lights converted to green once you’re done.Now click on the execute button.You
will get a status message “New Deletion jobs were scheduled”
Check the spool of the delete job. You will find some information related to the number of deleted data
objects and deleted database space in MB etc.
You can see the list of batch records in the spool which got archived successfully
The logical file name details can be seen using the transaction code FILE. Open this transaction and you can
find the list of file names under Logical file name Definitions folder. Search your logical file and double
clicking on it will take you to the Details screen.
Quite often , We come across huge set of materials , say 100000 material master records which are requested for archiving by customer
Staright away , I advice not to run the archiving delete step by dumping all the 1L records at a time.
It would sometimes cause a ST22 dump as shown below
While the Dump clearly says that it’s because of duplicate records, it’s not so. It’s because of huge number of materials we dumped in.
It’s due to resource bottle neck. Remember the table fetches/clears the records not just only from MARA , but it accesses other tables which can be time consuming. You can check the list of database tables used by the option “Database Tables” available on SARA transaction initial screen
It’s suggested that divide the set of materials into Sets say a 10 , each set consisting of 10000 , or say 20 * 5000 and then execute the archiving steps
Batch Master Records are Archived and Deleted from the database successfully.
Visit the following web pages