Ansicht
Dokumentation

RKE_CHACO_PAOBJNR_3 - Copy Prof. Segements for Operating Concern Split

RKE_CHACO_PAOBJNR_3 - Copy Prof. Segements for Operating Concern Split

Addresses (Business Address Services)   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

WARNING: This program should only be used in consultation with the SAP development team for CO-PA. You need to ensure that a data backup has been generated for the entire system before the program is used in a production system.

Purpose

The program can be used in cases where the assignment between controlling areas and operating concerns needs to be changed to reflect changes made to the organizational structure of a company.

In particular, it can be used where several controlling areas that are assigned to one operating concern are to be distributed to several operating concerns.

Integration

Within the value flow logic in the ERP system, the profitability segment number for document line items posted in Profitability Analysis (CO-PA) is updated in the document tables of the components SD, FI, MM, and CO in the PAOBJNR field.

The operating concern in which this profitability segment number is valid is determined indirectly from the organizational units stored in the document tables and also from the company structure stored in Customizing.

If the assignment between controlling areas and operating concerns is subsequently changed in a system, this means that the system can no longer correctly interpret any profitability segments stored in the document tables prior to this realignment.

Due to the changed assignment for the controlling areas, the system then erroneously searches for an affected profitability segment in the new operating concern, whereas the profitability segment was originally created in the old operating concern and can only be interpreted in that operating concern.

A distinction can be made between two types of cases in which the system tries to interpret a given profitability segment number with reference to an incorrect operating concern. If the profitability segment number does not exist in the new operating concern, then a short dump is regularly returned with the message number KE499. If, on the other hand, a profitability segment with the same number should happen to exist in the new operating concern, the system then works with the characteristic values for that particular profitability segment. This leads either to follow-up errors during further processing of the document, or, in the worst case, to incorrect data being updated in CO-PA.

Program RKE_CHACO_PAOBJNR_3 can be used to overcome this problem.

With this program, the profitability segments of an old operating concern that relate to a controlling area are copied to a new operating concern, and consequently made available there. Once the controlling area has been reassigned, the system is able to find the profitability segments created in the old operating concern in the new operating concern, and can interpret them correctly.

This program cannot, however, be used to convert either costing-based or account-based transaction data. If you need to do this, use programs COPA_COPY or RKE_CHACO_PAOBJNR_4.

Prerequisites

The form of Profitability Analysis activated in both the old and the new operating concern makes no difference to the execution of the program.

Another prerequisite for this program is that the Customizing assignments between controlling areas and operating concerns should not be changed before executing the steps described below under Activities. The program cannot run a check on whether this is the case.

Furthermore, profitability segments could already have been determined in the new operating concern. The program would then generate a short dump SAPSQL_ARRAY_INSERT_DUPREC when copying the profitability segments. The reason for this is that the number range intervals for the profitability segments depend on the operating concern, and could overlap. When copying, the program would attempt to insert entries with existing profitability numbers in the new operating concern, which would result in the short dump mentioned above.

The following scenario for changing the assignment between controlling areas and operating concerns is supported: several controlling areas that are assigned to one operating concern are to be assigned to several new operating concerns.

The following example demonstrates this for the controlling areas 1000 and 2000 and for the operating concerns C001 and D001:

Old assignments New assignments
1000 --> C001 1000 --> C001
2000 --> C001 2000 --> D001

Features

You need to execute the program for each new controlling area to be assigned before changing the Customizing assignments.

The program copies the profitability segments relating to the controlling area from the old to the new operating concern first. Once the controlling area has been reassigned, the system finds profitability segment numbers already created in the old operating concern now in the new operating concern, when the numbers are requested. This can be the case, for example, when a billing document is cancelled.

Specifically the following three tables are copied, where XXXX describes the old and YYYY the new operating concern:

CE4XXXX --> CE4YYYY ('Real' operating concerns)
CE4XXXX_ACCT --> CE4YYYY_ACCT (Account assignment numbers)
CE4XXXX_FLAG --> CE4YYYY_FLAG (Indicator for manual account assignment)

In the second step, the program raises the number range status for the profitability segments in the new operating concern to a value that is higher than the maximum of the profitability numbers in the old operating concern. This ensures that a profitability segment number that has already been created in the old operating concern and copied in the first step is not used again for profitability segments that are now to be created in the new operating concern.

Finally, the field REC_OBJNR1 (Object number for settlement receiver) in table COBRB can be converted, as the operating concern is also coded in this field for settlement rules to operating concern. However, the field REC_OBJNR1 is only used to make it possible to read the text of a settlement receiver from this master record. As profitability segments do not have a master record of this sort, this step cannot be considered essential, but you should nevertheless carry it out.

Activities

As preparation, you can first determine the data volume for tables to be copied (CE4XXXX, CE4XXXX_ACCT and CE4XXXX_FLAG), so gaining an overview of the number of table lines to be copied. (XXXX here designates the old operating concern.) For this, choose

,,Extras -> Determine Data Volume

from the menu in the selection screen and confirm the dialog box asking whether you want to continue by choosing Yes. Enter the desired combination Controlling Area / Old Operating Concern. Because determination of the data volume can take a while, it must be started in the background. The program creates the job ZZRKE_CHACO_CHECK_SIZE_3 and you can specify a start time in the screen that then appears. The job is automatically scheduled and released. The results are saved in the spool list for the job, which you can call up by choosing

,,Goto --> Job Overview.

The steps required for performing the program are described below.

Step 1

Ensure that no documents are posted to the system while the program is being executed.

Step 2

Start the program for each new controlling area to be assigned before changing the Customizing assignments.

The following areas of the selection screen are to be filled in this process:

Organizational units

Old Operating Concern / New Active Operating Concern:

Enter the controlling area to be reassigned, the old operating concern and also the new active operating concern.

Example

Old assignments New assignments
1000 --> C001 1000 --> C001
2000 --> C001 2000 --> D001

In this case, the program only needs to be started for the combination 2000 (Controlling Area) C001 (Old Operating Concern) and D001 (New Active Operating Concern).

Control Parameters

Test Run:

With this option, the program is executed in a test run for the step selected in the Processing Steps area. Processing can be executed in the foreground or in the background. The program generates a log and issues error messages if errors occur. To keep the log manageable, processing ends once the number of errors exceeds 100.

No database changes are made in this mode. The program makes a note of the step for which the test run was started and whether it ran without errors.

Update Run:

With this option, the program is executed in an update run for the step selected in the Processing Steps area. Processing should be started in the background to avoid the risk of a time out.

The program can only be executed in an update run if a test run has already been performed previously with no errors for the selected step.

Here also, the program makes a note of the step for which the update run was started and whether it ran without errors.

Lock Operation Concern (for the 'Update Run' option):

This option is only available for update runs. It locks the old and the new active operating concern against postings. Users trying to post data to these operating concerns receive an appropriate error message.

User Exit for Field Assignment:

This option is only available for the processing step

Copy Profitability Segments into New Active Operating Concern

and makes it possible to set up, by using a user exit, the characteristic assignments between the old and new active operating concern individually (see also Converting the Profitability Segments).

Identification for User Exit:

This option is only available if the selection option

User Exit for Field Assignment has been set. It makes it possible to uniquely identify the user exit.

Converting the Profitability Segments:

This section describes the logic applied for transferring a profitability segment created in the old operating concern into a profitability segment in the new active operating concern.

Note that a MOVE-CORRESPONDING between fields of the same name in the old and the new active operating concern is always performed first in this program.

You have the additional option of applying a logic stored in a user exit to transfer CO-PA characteristics from the old operating concern into the new active operating concern. Provided the exit is activated, it is accessed for each profitability segment after the MOVE-CORRESPONDING step. Fields in the new active operating concern that have already been filled using the MOVE-CORRESPONDING logic can be changed subsequently in the exit.

To activate the exit, an entry has to be added to the TKEEXITS table. You can use transaction SE16 to maintain the table in the following way:

EXITID 'KE_CHACO_CE4'
APPL 'KE'
SEQNO '001'
ISACTIVE 'X'
REPORT Program name of a ZZ... program
FORM Name of a form routine in program REPORT

For the exit to be accessed at all, the

User Exit for Field Assignment indicator has to be set. A three-character abbreviation then needs to be entered in the Identification for User Exit field.

The exit logic is implemented in the form routine FORM of the program REPORT. The form routine has the following six transfer parameters (in this order):

  • Controlling area
  • Old operating concern
  • New active operating concern
  • Table name of the table to be copied: one of the table names CE4XXXX, CE4XXXX_ACCT or CE4XXXX_FLAG is transferred, where XXXX designates the old operating concern.
  • Identification for user exit: the exit ID entered in the selection screen is transferred.
  • Indicator specifying whether the exit is active and whether it is to be called up in subsequent program runs: you need to set this indicator in the coding so that the exit is called for the subsequent profitability segments.
  • Characteristics vector of the old operating concern: the characteristics vector is transferred in the structure that is in the above parameter Table name of the table to be copied, meaning CE4XXXX, CE4XXXX_ACCT or CE4XXXX_FLAG.
  • Characteristics vector of the new active operating concern after the MOVE-CORRESPONDING step: the characteristics vector is transferred in the same way as that of the old operating concern, except XXXX has to be replaced with the new active operating concern YYYY. Hence if the characteristics vector of the old operating concern were the structure CE4XXXX_ACCT, then the characteristics vector of the new active operating concern would be the structure CE4YYYY_ACCT.

Example

If

  • 0001 stands for the controlling area
  • 'S001' stands for the old operating concern
  • 'IDEA' for the new active operating concern
  • CE4S001_ACCT for the table to be copied
  • ABC for the Identification of the User Exit

and the characteristic 'Customer' (KNDNR) is always to be set to 0000001001 in the new active operating concern if it had the value 0000001000 in the old operating concern, the exit implementation could appear as follows:

Entry in Table TKEEXITS:

EXITID 'KE_CHACO_CE4'
APPL 'KE'
SEQNO '001'
ISACTIVE 'X'
REPORT ZZKE_CHACO_CE4
FORM MODIFY_CHARACTERISTICS

Implementation of the EXIT in Program ZZKE_CHACO_CE4:

REPORT ZZKE_CHACO_CE4.

....
FORM MOVE_CHARACTERISTICS
  CHANGING I_KOKRSO      LIKE CEST1-KOKRS
           I_ERKRS_OLD   LIKE TKEBB-ERKRS
           I_ERKRS_NEW   LIKE TKEBB-ERKRS
           I_TABNAME     LIKE DD03L-TABNAME
           I_EXITID      TYPE KEDRSTEPID
           I_EXIT_ACTIVE TYPE C
           IS_CE4_OLD    TYPE ANY
          IS_CE4_NEW    TYPE ANY.

  DATA: LS_CE4S001_ACCT LIKE CE4S001_ACCT,
        LS_CE4IDEA_ACCT LIKE CE4IDEA_ACCT.

  CASE I_EXITID.
    WHEN 'ABC'.
      IF I_KOKRSO = '0001' AND
         I_ERKRS_OLD = 'S001' AND
         I_ERKRS_NEW = 'IDEA' AND
         I_TABNAME = 'CE4S001_ACCT'.
        I_EXIT_ACTIVE = 'X'. "Activate for further
                           "processing
        LS_CE4S001_ACCT = IS_CE4_OLD.
        LS_CE4IDEA_ACCT = IS_CE4_NEW.
        IF LS_CE4S001_ACCT-KNDNR = '0000001000'.
         LS_CE4IDEA_ACCT-KNDNR = '0000001001'.
        ENDIF.
        IS_CE4_NEW = LS_CE4IDEA_ACCT. "Return chars. of
                                     "new active op.
                                     "conc.
      ENDIF.
  ENDCASE.

ENDFORM.
....

New Number Range Status:

This option is only available for the step Raise Number Range Object COPA_OBJ in New Active Operating Concern. Here a new number range status can be explicitly specified for the profitability segment numbers (object COPA_OBJ) in the new active operating concern. The system automatically proposes a level that is higher than the maximum of the numbers posted in the old operating concern. This can be increased manually.

Processing steps

Execute the program for the selected combination of controlling area , old operating concern, new active operating concern, and also the corresponding additional options, for the three steps A to C as set out below.

Step A: Copy Profitability Segments into New Active Operating Concern:

In this step, the following three tables are copied, where XXXX describes the old and YYYY the new active operating concern:

CE4XXXX --> CE4YYYY ('Real' operating concerns)
CE4XXXX_ACCT --> CE4YYYY_ACCT (Account assignment numbers)
CE4XXXX_FLAG --> CE4YYYY_FLAG (Indicator for manual account assignment)

In this step, the program copies the data in packages of 100,000 records in ascending order of profitability segment numbers. Since the system notes the highest number that has already been copied, it is possible to use the restart option, meaning in the event of a program termination due, for example, to database problems you can simply restart it with the same selections.

Step B: Raise Number Range Object COPA_OBJ in New Active Operating Concern:

In this step, the program sets the number range status for the profitability segment numbers (object COPA_OBJ) in the new active operating concern to a value that is higher than the maximum of the profitability segment numbers in the old operating concern. In doing so, the program proposes a value in the New Number Range Statusfield that can be adjusted to be a higher figure.

Step C: Convert Field COBRB-REC_OBJNR1:

In this step, the program converts the field REC_OBJNR1(Object number for settlement receiver) in table COBRB, where the settlement rules are stored. The field content for the settlement rules to profitability segment is in the form EOXXXXYYYYYYYYYY. In this instance XXXX designates the operating concern and YYYYYYYYYY the profitability segment number. Field REC_OBJNR1 is used to make it possible to read the text of a settlement receiver from this master record. As profitability segments do not have a master record of this sort, the conversion of this field cannot be considered essential, but you should nevertheless carry it out. If the program terminates due to database problems, for example, you can restart the step with the same selections, meaning the restart option also applies.

You can only ever execute the individual steps in an update run providing a test run has already been successfully carried out. Moreover, you must also have successfully carried out step A before you can proceed to steps B and C.

The status for each of the steps is displayed on the program selection screen as a traffic light next to the steps. These display the status for the relevant step and a special combination of controlling area, old operating concern and new active operating concern. If the traffic light is

  • green, an update run has already been successfully carried out
  • yellow, a test run has already been successfully carried out, but no the update run.
  • red, no test run has yet been successfully run.

To delete status records you can use the menu path

,,Extras --> Delete Status Information.

On the overview screen that appears, you can select the status records to be deleted as in the program selection screen corresponding to the areas Organizational Units, Control Parameters and Processing Steps. Confirm the confirmation prompt that appears with Yes.

Step 3

There are different methods for processing the profitability segments and transaction data already posted for the reassigned controlling areas in the old operating concerns.

If costing-based Profitability Analysis is active in the old operating concern and the new active operating concern, you can copy the costing-based transaction data for the reassigned controlling area from the old operating concern to the new active operating concerns using program COPA_COPY.

Nevertheless, the profitability segments and costing-based transaction data can be retained in the old operating concern, should you still need to execute reports on the data already posted.

If the costing-based transaction data is to be deleted from the old operating concern, you can use the CO-PA archiving tool with the object COPA1_XXXX, where XXXX designates the old operating concern.

In addition, if account-based Profitability Analysis is active in the old operating concern and the new active operating concern, you can convert the account-based data from the old operating concern to the new active operating concern using program RKE_CHACO_PAOBJNR_4.

If you also want to delete the profitability segments concerned from the old operating concern, you can also do this using the CO-PA archiving tool by implementing SAP Note 383728. However, you should only do this once programs COPA_COPY and RKE_CHACO_PAOBJNR_4 have been run (if this is necessary).

Step 4

In Customizing under

,,Enterprise Structure --> Assignment --> Controlling --> Assign Controlling Area to Operating Concern

change the controlling area assignments from the old to the new active operating concerns.

Step 5

In Profitability Analysis Customizing under ,,Flows of Actual Values --> Activate Profitability Analysis activate the new active operating concerns.






ROGBILLS - Synchronize billing plans   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 26866 Date: 20240520 Time: 091507     sap01-206 ( 426 ms )