Archiving And Deletion Of Production Order
In this post I am giving overview of Production Order Archiving process in SAP. Archiving is nothing but writes an extract of the eligible database records into the archive and deletes the records from the database. Hence also explaining what is logical deletion and what is physical deletion of production order. Today archiving serves the following purposes:
- Data privacy
- Save memory in the HANA database.
- Physical deletion of unused and old production orders from database.
Overview of Archiving
1. Archiving Object: Archiving of data is based on archiving objects, which groups the related data together in SAP. Archiving is done is 2 phases, one is writing data into archiving file and second phase is deletion of data using archiving file. Archiving in SAP use ADK framework which handles processing of all archiving data. These two phases call relevant ADK function module to group related data into the archiving object. Production order Archiving object is PP_ORDER. AOBJ is transaction to see configuration of PP_ORDER.
2. Archiving Class: Archiving classes can be included in archiving object to consistently archive and access data that belongs together from technical and application point of view. One archiving class can be used in other archiving class. Transaction to see archiving class used in archiving object in ACLA.
|Initialize the archive class||P_ORDER_ARCHIVE_OBJECT||This function module will load the necessary archive class|
|Put data to archive file||P_ORDER_ARCHIVE_PUT_TABLE||This function module will write the data into archive file|
|Read data from archive file||P_ORDER_ARCHIVE_GET_TABLE||This function will read the data from archive file|
These function modules are used in below reports for archiving of production order. There can be many sub classes as well in an archive class. P_ORDER also has sub archive classes.
3. Archiving Tools: SARA is the archiving tool. This tool also shows dependencies of different archiving run based on the system configuration. Archiving process has following steps:
|Preparation run||PPARCHP1||This report will set the deletion indicator for the production order|
|Archiving||PPARCHA1||This report will Archive the production order|
|Deletion||PPARCHD1||This report will physically delete the production order|
Transaction SARA is also using same reports configured in the archiving object PP_ORDER. .
4.Logical deletion: At present old and outdated production orders can be archived using Archiving object PP_ORDER. Archiving of production order means orders will not be available for any further use. But after archiving also the Production order header entry will be visible in the table AUFK. Production order data is not physically deleted from the database it will just be restricted for any further used. This is logical deletion of the production order. Below are the steps to logically delete the Production order.
Goto transaction CO02 and open a production order. Setting the deletion flag and technically complete status for production order will logically delete the production order. It means order entry will be visible in the order header table AUFK but will restrict the further use of production order. Deletion flag LOKEZ will be set for the production order.
Now the above order is ready for archiving and restricted from any further use in the system.
5.Physical Deletion: But what if we want to delete the order entry from header table. This is physical deletion of production order. This can be only be done through the Archiving deletion report of production order. For same archiving object PP_ORDER we have one deletion report as well. For old and unused orders Archiving deletion report can be used to delete the orders physically from the database. Entry for the order will be removed from header table AUFK as well as item tables. Below are the steps to physically delete the production order
For this first we need to set Deletion Indicator of production order. This indicator is different from the LOEKZ(deletion flag). This indicator is set through the preparation run report of Archiving. Report will mark the production order ready for archiving and deletion. After marking production order ready for deletion, we can archive and delete the production order through respective run report.
Steps to Archive and Delete Production Order
2.Archive: After setting the deletion indicator execute archiving run report to archive the production order. On archiving the production order one archive file will be generated.
3. Delete: The archiving file then will contain all the data related to the production order. This same archived file now can be used to delete the order. Execute the deletion run report to to delete the production order. For deleting chose the file you have created while archiving the order. Chose the latest file archived
After archiving production order and also performing deletion we can check the database tables for the production order entry. Now goto SE11 and check header table and item table. Entry will be physically deleted from the database.