Programme SAP RKE_CHACO_PAOBJNR_3 - Copy Prof. Segements for Operating Concern Split

WARNING: This program should only be used in consultation with the SAPdevelopment team for CO-PA. You need to ensure that a data backup hasbeen generated for the entire system before the program is used in aproduction system.

Purpose
The program can be used in cases where the assignment betweencontrolling areas and operating concerns needs to be changed to reflectchanges made to the organizational structure of a company.
In particular, it can be used where several controlling areas that areassigned to one operating concern are to be distributed to severaloperating concerns.

Integration
Within the value flow logic in the ERP system, the profitability segmentnumber for document line items posted in Profitability Analysis (CO-PA)is updated in the document tables of the components SD, FI, MM, and COin the PAOBJNR field.
The operating concern in which this profitability segment number isvalid is determined indirectly from the organizational units stored inthe document tables and also from the company structure stored inCustomizing.
If the assignment between controlling areas and operating concerns issubsequently changed in a system, this means that the system can nolonger correctly interpret any profitability segments stored in thedocument tables prior to this realignment.
Due to the changed assignment for the controlling areas, the system thenerroneously searches for an affected profitability segment in the newoperating concern, whereas the profitability segment was originallycreated in the old operating concern and can only be interpreted in thatoperating concern.
A distinction can be made between two types of cases in which the systemtries to interpret a given profitability segment number with referenceto an incorrect operating concern. If the profitability segment numberdoes not exist in the new operating concern, then a short dump isregularly returned with the message number KE499. If, on the other hand,a profitability segment with the same number should happen to exist inthe new operating concern, the system then works with the characteristicvalues for that particular profitability segment. This leads either tofollow-up errors during further processing of the document, or, in theworst 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 operatingconcern that relate to a controlling area are copied to a new operatingconcern, and consequently made available there. Once the controllingarea has been reassigned, the system is able to find the profitabilitysegments created in the old operating concern in the new operatingconcern, and can interpret them correctly.
This program cannot, however, be used to convert eithercosting-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 newoperating concern makes no difference to the execution of the program.
Another prerequisite for this program is that the Customizingassignments between controlling areas and operating concerns shouldnot be changed before executing the steps described belowunder Activities. The program cannot run a check on whether thisis the case.
Furthermore, profitability segments could already have been determinedin the new operating concern. The program would then generate a shortdump SAPSQL_ARRAY_INSERT_DUPREC when copying the profitability segments.The reason for this is that the number range intervals for theprofitability segments depend on the operating concern, and couldoverlap. When copying, the program would attempt to insert entries withexisting profitability numbers in the new operating concern, which wouldresult in the short dump mentioned above.
The following scenario for changing the assignment between controllingareas and operating concerns is supported: several controlling areasthat are assigned to one operating concern are to be assigned to severalnew operating concerns.
The following example demonstrates this for the controlling areas1000 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 beassigned before changing the Customizing assignments.
The program copies the profitability segments relating to thecontrolling area from the old to the new operating concern first. Oncethe controlling area has been reassigned, the system finds profitabilitysegment numbers already created in the old operating concern now in thenew operating concern, when the numbers are requested. This can be thecase, for example, when a billing document is cancelled.
Specifically the following three tables are copied, where XXXX describesthe 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 accountassignment)
In the second step, the program raises the number range status for theprofitability segments in the new operating concern to a value that ishigher than the maximum of the profitability numbers in the oldoperating concern. This ensures that a profitability segment number thathas already been created in the old operating concern and copied in thefirst step is not used again for profitability segments that are now tobe created in the new operating concern.
Finally, the field REC_OBJNR1 (Object number for settlement receiver) intable COBRB can be converted, as the operating concern is also coded inthis field for settlement rules to operating concern. However, the fieldREC_OBJNR1 is only used to make it possible to read the text of asettlement receiver from this master record. As profitability segmentsdo not have a master record of this sort, this step cannot be consideredessential, but you should nevertheless carry it out.

Activities
As preparation, you can first determine the data volume for tables to becopied (CE4XXXX, CE4XXXX_ACCT and CE4XXXX_FLAG), so gaining an overviewof the number of table lines to be copied. (XXXX here designates the oldoperating concern.) For this, choose
,,Extras -> Determine Data Volume
from the menu in the selection screen and confirm the dialog box askingwhether you want to continue by choosing Yes. Enter the desiredcombination Controlling Area / Old Operating Concern. Becausedetermination of the data volume can take a while, it must be started inthe 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 savedin 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 isbeing executed.

Step 2
Start the program for each new controlling area to be assignedbefore changing the Customizing assignments.
The following areas of the selection screen are to be filled in thisprocess:

Organizational units
Old Operating Concern / New Active Operating Concern:
Enter the controlling area to be reassigned, the old operating concernand 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 combination2000 (Controlling Area) C001 (Old Operating Concern) and D001 (NewActive Operating Concern).

Control Parameters
Test Run:
With this option, the program is executed in a test run for the stepselected in the Processing Steps area. Processing can be executedin the foreground or in the background. The program generates a log andissues 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 ofthe step for which the test run was started and whether it ran withouterrors.
Update Run:
With this option, the program is executed in an update run for the stepselected in the Processing Steps area. Processing should bestarted 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 hasalready been performed previously with no errors for the selected step.

Here also, the program makes a note of the step for which the update runwas 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 oldand the new active operating concern against postings. Users trying topost data to these operating concerns receive an appropriate errormessage.
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, thecharacteristic assignments between the old and new active operatingconcern 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 itpossible to uniquely identify the user exit.
Converting the Profitability Segments:
This section describes the logic applied for transferring aprofitability segment created in the old operating concern into aprofitability segment in the new active operating concern.
Note that a MOVE-CORRESPONDING between fields of the same name inthe old and the new active operating concern is always performed firstin this program.
You have the additional option of applying a logic stored in a user exitto transfer CO-PA characteristics from the old operating concern intothe new active operating concern. Provided the exit is activated, it isaccessed for each profitability segment after theMOVE-CORRESPONDING step. Fields in the new active operating concern thathave already been filled using the MOVE-CORRESPONDING logic can bechanged 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. Athree-character abbreviation then needs to be entered in theIdentification for User Exit field.
The exit logic is implemented in the form routine FORM of the programREPORT. The form routine has the following six transfer parameters (inthis 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 theold 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 inthe coding so that the exit is called for the subsequent profitabilitysegments.
        • Characteristics vector of the old operating concern: the characteristics
        • vector is transferred in the structure that is in the above parameterTable name of the table to be copied, meaning CE4XXXX, CE4XXXX_ACCT orCE4XXXX_FLAG.
          • Characteristics vector of the new active operating concern after the
          • MOVE-CORRESPONDING step: the characteristics vector is transferred inthe same way as that of the old operating concern, except XXXX has to bereplaced with the new active operating concern YYYY. Hence if thecharacteristics vector of the old operating concern were the structureCE4XXXX_ACCT, then the characteristics vector of the new activeoperating 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 to0000001001 in the new active operating concern if it had the value0000001000 in the old operating concern, the exit implementation couldappear 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 ObjectCOPA_OBJ in New Active Operating Concern. Here a new number rangestatus can be explicitly specified for the profitability segment numbers(object COPA_OBJ) in the new active operating concern. The systemautomatically proposes a level that is higher than the maximum of thenumbers posted in the old operating concern. This can be increasedmanually.

              Processing steps
              Execute the program for the selected combination of controlling area, old operating concern, new active operating concern, and also thecorresponding additional options, for the three steps A to C as set outbelow.
              Step A: Copy Profitability Segments into New Active OperatingConcern:
              In this step, the following three tables are copied, where XXXXdescribes 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 accountassignment)
              In this step, the program copies the data in packages of 100,000 recordsin ascending order of profitability segment numbers. Since the systemnotes the highest number that has already been copied, it is possible touse the restart option, meaning in the event of a program terminationdue, for example, to database problems you can simply restart it withthe same selections.
              Step B: Raise Number Range Object COPA_OBJ in New Active OperatingConcern:
              In this step, the program sets the number range status for theprofitability segment numbers (object COPA_OBJ) in the new activeoperating concern to a value that is higher than the maximum of theprofitability segment numbers in the old operating concern. In doing so,the program proposes a value in the New Number Range Status fieldthat 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 (Objectnumber for settlement receiver) in table COBRB, where thesettlement rules are stored. The field content for the settlement rulesto profitability segment is in the form EOXXXXYYYYYYYYYY. In thisinstance XXXX designates the operating concern and YYYYYYYYYY theprofitability segment number. Field REC_OBJNR1 is used to make itpossible to read the text of a settlement receiver from this masterrecord. As profitability segments do not have a master record of thissort, the conversion of this field cannot be considered essential, butyou should nevertheless carry it out. If the program terminates due todatabase problems, for example, you can restart the step with the sameselections, meaning the restart option also applies.
              You can only ever execute the individual steps in an update runproviding a test run has already been successfully carried out. Moreover
              , you must also have successfully carried out step A before you canproceed to steps B and C.
              The status for each of the steps is displayed on the programselection screen as a traffic light next to the steps. Thesedisplay the status for the relevant step and a special combination ofcontrolling area, old operating concern and new active operatingconcern. 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 recordsto be deleted as in the program selection screen corresponding to theareas Organizational Units, Control Parameters andProcessing Steps. Confirm the confirmation prompt that appearswith Yes.

                  Step 3
                  There are different methods for processing the profitabilitysegments and transaction data already posted for thereassigned controlling areas in the old operating concerns.
                  If costing-based Profitability Analysis is active in the oldoperating concern and the new active operating concern, you can copy thecosting-based transaction data for the reassigned controllingarea from the old operating concern to the new active operating concernsusing program COPA_COPY.
                  Nevertheless, the profitability segments and costing-basedtransaction data can be retained in the old operating concern, shouldyou still need to execute reports on the data already posted.
                  If the costing-based transaction data is to be deleted from the oldoperating 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 inthe old operating concern and the new active operating concern, you canconvert the account-based data from the old operating concern tothe new active operating concern using program RKE_CHACO_PAOBJNR_4
                  .
                  If you also want to delete the profitability segments concerned from theold operating concern, you can also do this using the CO-PA archivingtool by implementing SAP Note 383728. However, you should only dothis once programs COPA_COPY and RKE_CHACO_PAOBJNR_4 have been run (ifthis is necessary).

                  Step 4
                  In Customizing under
                  ,,Enterprise Structure --> Assignment --> Controlling --> AssignControlling Area to Operating Concern
                  change the controlling area assignments from the old to the new activeoperating concerns.

                  Step 5
                  In Profitability Analysis Customizing under ,,Flows of Actual Values--> Activate Profitability Analysis activate the new active operatingconcerns.