Skip to end of metadata
Go to start of metadata

Purpose

The purpose of this WIKI is to show the difference between archiving in different releases and provide the necessary steps for all of them.

Overview: An introduction of archiving:

Definition

When you generate an operating concern in Profitability Analysis (CO-PA), the system automatically generates the following archiving objects and the corresponding write, delete, and reload programs (xxxx is the name of the operating concern):

  • For costing-based Profitability Analysis:

¡        COPAA_xxxx

¡        COPAB_xxxx

¡        COPA1_xxxx

  • For account-based Profitability Analysis: COPA2_xxxx
  • For Profitability Segments: COPAC_xxxx

The archiving objects COPAA_xxxx and COPAB_xxxx replace the archiving object COPA1_xxxx.

Please note that data from COPAA_xxxx has to be archived before the data from COPAB_xxxx. If not you will notice that the number of written data objects is 0 from the COPAB_xxxx job spool.


Although the archiving object COPA1_xxxx can still be used, we recommend only using the new archiving objects. For example, only these archiving objects have an IMG activity for preparing archiving in Customizing, whereas the archiving object COPA1_xxxx does not.

It is recommended to use archiving object COPAA_XXXX to archive data from beginning of a fiscal year. For example if for FY10 half the data has been archived using COPA1_XXXX and the other half is archived using COPAA_XXXX, when a user executes a report from KE30 for the whole FY10 it would not be possible to display all the archived data. Either the data archived using COPA1_XXXX or the data archived using COPAA_XXXX can be displayed. So in this case the second half of FY10 should be archived using archiving object COPA1_XXXX and COPAA_XXXX should be used from FY11 onwards.

Structure

You can archive the following tables in costing-based Profitability Analysis:

  • Actual line items (table(s) CE1xxxx) with the archiving object COPAA_xxxx or COPA1_xxxx (not recommended)
  • Plan line items (table(s) CE2xxxx) with the archiving object COPAA_xxxx or COPA1_xxxx (not recommended)
  • Segment level (table(s) CE3xxxx) with the archiving object COPAB_xxxx or COPA1_xxxx (not recommended)
  • Transaction-based distribution (table CEALE01) with the archiving object COPAA_xxxx or COPA1_xxxx (not recommended)

Table CEAL01 can only be archived if distributed Profitability Analysis (with ALE) is active and data is distributed by transaction. Table CEALE01 in the target system contains the references to the line items in the sender system. Our line items archiving will always archive CE1XXXX and appropriate CEALE01 entries in one step. If you want to delete only the items in CEALE01, we need to do this manually or by a z-report.


In account-based Profitability Analysis, you can use archiving object COPA2_xxxx to archive the following:

  • CO line items (tables concerned: COEP, COEJ, COBK)
  • Totals record tables (tables concerned: COSS, COSP, COKA)

For both forms of Profitability Analysis, you can use archiving object COPAC_xxxx or COPA1_xxxx (not recommended) to archive the following:

  • Profitability segments (table(s) concerned: CE4xxxx)
  • Account assignment number (tables concerned: CE4xxxx_ACCT, CE4xxxx_FLAG)

It is not possible to archive PA Segments using date/period in archiving object COPAC_XXXX as PA segments are time independent and COPAC_XXXX archives data from CE4XXXX Table

This is because PA segments are time-independent.

To explain this let us take a very simple example. Let us say you have only 2 characteristics product and customer. Assume you have only 2 products P1 and P2 and 2 customers C1 and C2. So you have 4 possible combinations ( 4 entries in CE4XXXX)

PA segment no     combination

1                              P1C1

2                              P1C2

3                              P2C1

4                              P2C2


Now whenever you post say an invoice the system will check the customer and product and choose the PA segment. This is irrespective of the period or fiscal year.

So the above PA segments could be used for example 10 years.

However when the posting is done to the CO-PA line items table CE1XXXX the posting date is filled since line items are time dependent.

Field CE4XXXX-BISDAT has no effect on archiving. Bisdat is populated as DD.MM.99YY. When a new PA segment is created DD and MM are populated with the date and month of creation respectively and YY with the last 2 digits of the year of creation. For example if on 5th Feb, 2018 a new PA segment is created then Bisdat = 05.02.9918. Having this date in CE4XXXX helps us know when a profitability segment has been created. This information will sometimes be helpful for our problem analysis. However this logic does not have any effect on archiving or any other customer process. It is purely for our internal analysis.

To restrict the data to be archived, you can select different selection parameters in archiving. For this, you can choose from some fixed selection parameters. Moreover, in Customizing for Profitability Analysis under Tools ® Utilities ® Prepare Archiving, you can select characteristics from the profitability segment characteristics (segment level characteristics) and define them as selection parameters.

Please note that it is not possible to interrupt COPA Archiving for objects COPA1_XXXX & COPA2_XXXX.

This is because the objects COPA1_XXXX & COPA2_XXXX do not support the interruption functionality.

The objects COPAA_XXXX, COPAB_XXXX and COPAC_XXXX have the interrupt capability.


'Archive line items only' function.

In COPA2_XXXX Account-based, the flag 'Archive line items only' means the following: You choose this function in cases where only line items (tables COEP, COEJ, and COBK ) need to be archived. In this way, the totals Records (tables COSS, COSP, and COCA) are not archived. If you specify some periods, but not a full year without selecting 'Archive line items only' the message KE152 is issued, because total records tables (COSS and COSP) are structured different way than line item table COEP. They contain period information in different columns and there is no separate field that stores period information, such as in COEP. So, now you have the following two options : Archive only line items for half of the year (or any specified periods): Please do not forget to select the Plan/Actual Indicator beside specifying Year, Period and ticking 'Archive line items only' OR Archive the line items and total records for whole fiscal year : First the Plan/Actual Indicator needs to be selected in order to archive actual line items (Year, Period, flag 'Archive line items only') Afterwards archive the total Records without selecting period and the flag 'Archive line items only'.

In COPA1_XXXX Costing based, select this flag if you only want to delete line items (tables CE1xxxx and CE2xxxx, where "xxxx" = operating concern). In this case, the segment level (table CE3xxxx) will not be archived.





Phases in Archiving

 

You need to ensure that you check all the relevant applications from which you generate the COPA postings. When in doubt it is better to check the relevant application. System will check the relevant PAOBJNR in all the application tables and deactivate only those which it does not find (i.e. unused). The tables that are scanned are available in FORM fill_gt_table_scan in program RKE_COPAC_PREFORMS.
As you must be aware COPA receives data from various applications mainly SD, FI and MM. When example when an SD billing document is posted based on the combination of characteristics a PA segment no is generated. It is checked if this no is already existing in table CE4XXXX else a new entry is made.
A PA segment no is considered active as long as the application that generated it is still present in SAP tables. For example as long as the SD billing doc is still there in the SD tables the corresponding PA segment no is active. If you archive this SD billing doc then the corresponding PA segment no becomes inactive (provided it is not being referenced by any other billing, FI or MM doc).
The best practice is to archive the other application documents first (i.e. sales documents, material documents & FI docs) and then proceed with archiving Profitability Analysis, this would return considerable unused PA segments.

There are 3 phases in archiving of PA segments (archiving object COPAC_XXXX): 

1. In the preprocessing phase you identify the PA segments which are no longer used. These are set with AKTBO = ' '. 

2. In the write phase AKTBO is set to 'D' for the PA segments with AKTBO = ' '. These PA segments are written to the archive files. 

3. In the delete phase the PA segments with AKTBO = 'D' are deleted from the database.

In the write phase you need to give a range of PA segments. Single values are not supported.

There are 2 phases in archiving of COPA transaction data (archiving object COPAA_XXXX and COPAB_XXXX):

  1. In the write phase the data is read from the database based on the selection variant and the archive file is created based on the selected data.
  2. In the delete phase the archive file selected is read and the data contained in the selected archive file is deleted from the database.

In exception cases you can reload the archived data ( PA segments and transaction data) if needed.

Even if you flag only the 'edit CE4 table' the system checks the PAOBJNR in both CE4XXXX_ACCT table and also CE3XXXX table. If the PAOBJNR exists in either CE4XXXX_ACCT table (CE4XXXX_ACCT-CE4KEY) or CE3XXXX table it is reactivated.
This consistency check is done because the preprocessing program can take a long time, sometimes even several days and in between it is possible that the PAOBJNR is used again.
Also note that for CE3XXXX to be archived the corresponding CE1XXXX/CE2XXXX data needs to be archived first.
This means that a CE4XXXX-paobjnr cannot be deactivated unless it has been deactivated in the CE4XXXX_ACCT table and also archived from the CE3XXXX and line item tables CE1XXXX/CE2XXXX.

Integration

Archive Information System (AS)

Since the archiving objects in Profitability Analysis depend on the operating concern (which is generated at customer) and on the Customizing settings under Tools ® Utilities ® Prepare Archiving, the corresponding information structures and the field catalog must also be generated for the Archive Information System (AS).

The information structure and the field catalog are generated on the basis of the data object definition that you created in the IMG activity Prepare Archiving. From the technical standpoint, a data object corresponds to all data records in an archive file with the same combination of parameter values. With an optimal data object definition, the time required for AS to access the data in the archive can be reduced considerably. For more information, see the documentation on the IMG activity Prepare Archiving.

The information structure and the field catalog are also generated in the IMG activity Prepare Archiving. The following archiving objects are generated for the individual archiving objects:

  • Archiving object COPAA_xxxx: Field catalog and information structure SAP_COPAA_xxxx
  • Archiving object COPAB_xxxx: Field catalog SAP_COPAB_xxxx
  • Archiving object COPA2_xxxx: Field catalog and information structure SAP_COPA2_xxxx

In order that it be possible to use the information structures in a production system, they then have to be activated in AS. For more information about information structures, see Using the Archive Information System. For information about field catalogs, see under Field Catalogs.

To display archived data from the segment level (table CE3xxxx), you can (and should) use the Information System in Profitability Analysis. Here, you can define profitability reports that access the archive. When you define a profitability report (see Defining Profitability Reports), you activate the selection Use archived data on the Options tab page.

To display archived data from line items (tables CE1xxxx, CE2xxxx for costing-based Profitability Analysis and COEP, COEJ, COBK for account-based Profitability Analysis), you can and should use the transactions for displaying line items: KE24, KE25, and KE30 (for reports based on line items). You can display the data from the archive once you have set the Archive indicator in the menu under Extras® Data Source.

Information Lifecycle Management (ILM)

With note 1960092 COPA is integrated with ILM. Archiving objects COPAA_XXXX and COPAB_XXXX are integrated. The COPAC_XXXX archive object is used for archiving profitability segment numbers only.  There is no setup for ILM.

Archiving in 6.0 and above:

You may use archiving object COPAC_XXXX to archive the obsolete profitability segments. Please note that a new PA Segment will be generated when posting to COPA with the same characteristic combination as an archived PA segment.

Archiving in S/4HANA:

In order to archive account based COPA entries in table ACDOCA use transaction KE0H for object COPA2_XXXX. ACDOCA field XPAOBJNR_CO_REL is set to 'A', fields OBJNR and CO_BUZEI will be initialized.

Archiving as of S/4 Hana 1709:

From release S/4 HANA OP 1709 we will only use PA segments from table CE4XXXX_ACCT in most cases, means the CE4 number is not reused and are therefore time-dependent.
This makes it much easier to find the CE4 number to be archived, for instance if customer orders have been archived, then you can always find and archive the associated CE4XXXX_ACCT with the help of KAUFN.

Cancellation of COPA documents

Example: you reuse SD number ranges. Such practice is not recommended by SAP. Please have a look at the attached SAP Note 781802 that explains the situation.

The root cause of this issue is that 'old' sales orders were archived but the 'old' COPA records still exist in the system; as a result, they are now linked to the new created sales orders. As there are still CO-PA line items with Record type A in table CE1XXXX linked to archived sales orders, CO-PA is creating cancellations for "archived" sales orders. In order to prevent this problem from happening in the future, please consider archiving any 'old' COPA documents when the original document is archived if it is not possible to avoid reuse of SD number ranges.

In COPA we have access to only the reference document number i.e. the sales order number during the creation of the sales order. So due to the system design we cannot know that the record type A existing in the system belongs to a different sales order.


Related Content

Related Documents 

SAP HELP: Archiving CO-PA Transaction Data

Related Notes 

  • SAP NOTE 383728    - Archiving profitability segments
  • SAP NOTE 571189    - Deactivation of CE4xxxx_ACCT entries
  • SAP NOTE 1038939  - Archiving profitability segments II
  • SAP NOTE 1684574  - Archiving CE4XXXX_ACCT in older Releases
  • SAP NOTE 1889890 - Performance problems occur while deactivating unused profitability segment

  • SAP NOTE 2176823 - FAQ on CO-PA issues in S/4 HANA Finance (SFIN)
  • No labels