Skip to Content
Author's profile photo Lakshmana Srini

SAP Data Archiving – MM_SPSTOCK (Archiving Batch Master Records)

Applies to:

SAP ECC6 – Data Archive. For more information, visit the Data Management and Integration homepage

Summary

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

Author(s): Lakshman

Company:Wipro Technologies

Introduction

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

MSC2N.

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

Delete Step

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

Session

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.

Problem Encounters

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

Capture.PNG

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

in sequence

Conclusion:

Batch Master Records are Archived and Deleted from the database successfully.

Related Content

Visit the following web pages

http://www.help.sap.com

http://www.sdn.sap.com/irj/sdn/nw-mdm?rid=/webcontent/uuid/f062dd92-302d-2a10-fe81-ca1be331303c

http://help.sap.com/saphelp_dimp50/helpdata/en/8d/3e59fd462a11d189000000e8323d3a/frameset.htm

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jürgen Lins
      Jürgen Lins

      Please check your document, many pictures do not show up.

      The better place for this document is the ILM space which is the home space for data archiving.

      Author's profile photo Lakshmana Srini
      Lakshmana Srini
      Blog Post Author

      Thanks Jurgen,

      While posting the images , they are getting truncated on the extreme left side. I tried many times. Is there a better way for posting these images?

      Author's profile photo Jürgen Lins
      Jürgen Lins

      I never had this issue of truncated pictures. You may need to post a discussion in the

      in SCN Bug Reporting if this problem is only after uploading of pictures and not with the original pictures. I hope you uploaded the pictures instead of copy paste them.

      Regarding the content. The document is pretty straight forward, like the examples in a training. But when you are back home and try it yourself you usually hit one problem after the other. Unfortunately you did not mention any of them.

      E.g. batches are a kind of master data, which means they can only be archived after you have archived all transaction data where they have been used e.g. delivery , inspection lots, billing documents... so you could explain a large variety of potential errors.

      I remember numerous discussions in MM forum where people did not set the right combinations in the selection screen and archived either the wrong data or could not archive anything, as this MM_SPSTOCK can be used to archive  3 different kind of batches. I even have a matrix in my own documentation to avoid entering the wrong combination. So i am missing some sentences on that issue.


      Author's profile photo Lakshmana Srini
      Lakshmana Srini
      Blog Post Author

      Thanks a lot for your suggestions. Initially I thought of explaining the basic steps to perform archiving especially for beginners who doesn't have any knowledge on this topic.

      Anyways I will add few more points of what you said to the content . It will be a good idea to include the problems we frequently encounter while doing these process.

      Author's profile photo Lakshmana Srini
      Lakshmana Srini
      Blog Post Author

      Hi Jurgen

      I just move the article to ILM space