Programme SAP RKE_CHACO_PAOBJNR_1 - Conversion of Profitability Segments in Sender Tables

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
This 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 for instances where one or more operatingconcerns are to be replaced by just one new operating concern.
This program can be used to convert any profitability segments in thedocument tables for the components SD, FI, MM, and CO that have beenmade invalid by changes to the Customizing assignments betweencontrolling areas and operating concerns.

Integration
With the value flow logic in the ERP system, the profitability segmentnumber for document line items updated 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 thisprofitability segment number is valid is determined indirectly from theorganizational units stored in the document tables and also from thecompany structure stored in Customizing.
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 assignmentof the controlling area, the system then erroneously searches for anaffected profitability segment in the new operating concern, whereas theprofitability segment was originally created in the old operatingconcern and can only be interpreted in that operating 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_1 can be used to overcome this problem.
With this program, any profitability segment numbers from the oldoperating concern rendered invalid in the document tables for thecomponents SD, FI, MM, and CO are systematically replaced withprofitability segment numbers from the new operating concern. In doingso, the program is able to convert the data of several old operatingconcerns that is to be assigned to the same new operating concern in asingle run.

Prerequisites
The form of Profitability Analysis activated in both the old operatingconcerns and the new operating concerns is of no importance.
A prerequisite for this program is that the Customizing assignmentsbetween controlling areas and operating concerns should not have beenchanged before executing the steps described below inActivities. The program cannot run a check on whether this is thecase.
Furthermore, profitability segments could already have been determinedin the new operating concern and posted in the document tables in SD, FI
, MM, or CO. When converting the document tables, however, the programwould not be able to recognize whether a profitability segmentoriginates from an old or a new operating concern. The reason for thisis that the number range intervals for the profitability segments alwaysdepend on the operating concern, and the operating concern is determinedindirectly from the organizational units of the document tables. Thismeans that profitability segments from the new operating concern couldbe converted by mistake because the program assumes they are from an oldoperating concern.
The following scenarios are supported for changing the assignmentbetween controlling areas and operating concerns:
An operating concern needs to be replaced by another one. Allcontrolling areas assigned to the old operating concern are assigned toa new operating concern.
Multiple controlling areas assigned to multiple operating concerns needto be assigned to a new operating concern.
The following examples demonstrate this for the controlling areas1000 and 2000 and for the operating concerns C001, D001, and E001:
Example 1
,,Old assignments,,New assignments
,,1000 --> C001,,1000 --> E001
,,2000 --> C001,,2000 --> E001
Example 2
,,Old assignments,,New assignments
,,1000 --> C001 ,,1000 --> E001
,,2000 --> D001 ,,2000 --> E001
Bear in mind that all controlling areas assigned to an old operatingconcern must always be reassigned, and that all are to be assigned tothe same new operating concern.

Features
The program can be used first to increase the number range status ofnumber range object COPA_OBJ for the profitability segment numbers inthe new operating concern to a value that is higher than theprofitability segment numbers of the old operating concerns that havealready been posted. This means that newly created profitability segmentnumbers in the new operating concern can be clearly distinguished fromthose of the old operating concern, enabling the restart option of theprogram to be used should it terminate due to database problems, forexample.
The program supports two different variants of the conversion:

,,Case 1
Before the operating concerns are reassigned, the old Customizingassignments are saved first. Then the assignment between controllingareas and operating concerns is changed in Customizing. TheRKE_CHACO_PAOBJNR_1 program has to be executed for the combination ofold operating concerns and new operating concern.
During program execution, the system processes the document tableselected. From the organizational units (such as plant, salesorganization, company code, or controlling area) stored in the documenttable and on the basis of the old Customizing assignments storedpreviously, the system determines whether a profitability segmentbelongs to one of the old operating concerns that is being processed. Ifone does, a new profitability segment is determined in the new operatingconcern and loaded back into the document table.

,,Case 2
The assignment between controlling areas and operating concerns is notchanged before the program is executed. In this case, the oldCustomizing settings do not need to be saved. The program has to bestarted for the combination of old operating concerns and new operatingconcern.
During program execution, the system processes the document tableselected. From the organizational units (such as plant, salesorganization, company code, or controlling area) stored in the documenttable and on the basis of the current Customizing assignments,the system determines whether a profitability segment belongs to one ofthe old operating concerns that is being processed. If one does, a newprofitability segment is determined in the new operating concern thathas not yet been assigned to a controlling area, and loaded back intothe document table.
In both cases described, the field PAOBJNR is always converted inthe respective document table. In the case of some selected documenttables, however, the following special features apply:

  • Table COBRB: Here, the field REC_OBJNR1 (Object number for
  • settlement receiver) is converted, since the operating concern is codedin this field for settlement rules to operating concern. FieldREC_OBJNR1 is used to make it possible to read the text of a settlementreceiver from this master record. At the same time, the field SORT(Settlement rule sort field) in table COBRA can be converted,as the operating concern is also coded in this field for settlementrules to operating concern. The field is used in a display report forsettlement rules.
    • Table AUAA: Here, the field COOBJNR (Object number) is
    • also converted, since the operating concern is coded in this field as inthe first two cases. The field is used during settlement, such as forreversing settlements that have already occurred.
      The assignment between controlling areas and operating concerns can thenbe changed in Customizing.

      Activities
      Before executing the program, you can first automatically determine thedata volume for those document tables in the components SD, FI, MM, andCO that will be converted when the program is executed. This gives youan idea of the amount of table lines to be processed. 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 selecting Yes. Becausedetermination of the data volume can take a while, it must be started inthe background. The program creates the job ZZRKE_CHACO_CHECK_SIZE_1 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. Adistinction is made between cases 1 and 2 described above.

      ,,Case 1

      Step 1
      Ensure that no documents are posted to the system while the program isbeing executed.

      Step 2
      Start the RKE_CHACO_PAOBJNR_1 program and then choose ,,Extras ->Save Old Customizing Assignments
      in the menu of the selection screen.
      The program saves the old assignments currently stored in Customizing,including those between controlling areas and operating concerns.

      Step 3
      To display the saved assignments, choose
      ,,Extras -> Display Old Customizing Assignments.

      Step 4
      In Customizing under
      ,,Enterprise Structure --> Assignment --> Controlling --> AssignControlling Area to Operating Concern
      change the assignments of all controlling areas of the old operatingconcerns to the new operating concern.

      Step 5
      In Profitability Analysis Customizing under
      ,,Flows of Actual Values --> Activate Profitability Analysis
      activate (if necessary) the new operating concern.

      Step 6
      Start the program for the combination of old operating concerns andnew operating concern.
      The following areas of the selection screen are to be filled in thisprocess:

      Operating Concerns
      Old Operating Concerns / New Active Operating Concern:
      Enter here the old operating concerns and the new active operatingconcern.
      Example 1
      ,,Old assignments,,New assignments
      ,,1000 --> C001,,1000 --> E001
      ,,2000 --> C001,,2000 --> E001
      In this case, the program needs to be started for the combination C001 (
      Old Operating Concerns) and E001 (New Active OperatingConcern).
      Example 2
      ,,Old assignments,,New assignments
      ,,1000 --> C001,,1000 --> E001
      ,,2000 --> D001,,2000 --> E001
      In this case, the program needs to be started for the combination C001 /D001 (Old Operating Concerns) and E001 (New Active OperatingConcern).
      New Active Operating Concern Already Assigned / New Active OperatingConcern Not Yet Assigned:
      Where case 1 applies, choose the option New Active OperatingConcern Already Assigned. Using the organizational units stored inthe document tables and also taking into account the Customizingassignments saved previously, the program determines the old operatingconcern.
      Where case 2 applies, choose the option New Active OperatingConcern Not Yet Assigned.

      Control Parameters
      Test Run for a Profitability Segment:
      This option allows you to start the program for a profitability segmentfrom one of the old operating concerns. If you select this option, youcan enter a profitability segment number in the ProfitabilitySegment Selection field. In this instance, you must specifyexactly one old operating concern in the selection option OldOperating Concerns. When the program has been executed, the systemgenerates a log containing the characteristics vector in the old and newactive operating concern. The system displays

      • which characteristics have been transferred from the old to the new
      • operating concern
        • which characteristics have been converted in the user exit described
        • under Converting the Profitability Segments (see below)
          • which characteristics have been derived in the new active operating
          • concern, if the option Call up Derivation in New Active OperatingConcern (see below) has been selected. In this case you can alsobranch to the derivation analysis.
            Test Run:
            With this option, the program is executed in a test run for the stepselected in the Processing Steps area or the selectedapplication. Processing can be executed in the foreground or in thebackground. The program generates a log and issues error messages iferrors occur during characteristic derivation or the validity check ofthe characteristic values.
            To keep the log manageable, processing ends once the number of errorsexceeds 100. In this mode, no profitability segment numbers areconverted in the document tables. The system makes a note of theapplication for which the test run was started and whether it ranwithout errors.
            Update Run:
            With this option, the program is executed in an update run for the stepselected in the Processing Steps area or the selectedapplication. Processing should occur in the background, due tothe risk of a timeout.
            The program can only be executed in an update run if a test run hasalready been performed with no errors for the selected step orapplication.
            Convert table CE4XXXX_FLAG:
            As of SAP 4.6C, the information whether manual entries have been madefor a profitability segment on the CO-PA account assignment screen isstored in table CE4XXXX_FLAG. Consequently, this table does not containentries for every profitability segment. Nevertheless, it still needs tobe converted.
            This option is not ready for input, and is displayed only as ofSAP 4.6C, as table CE4XXXX_FLAG did not exist up to SAP 4.6B
            For the logic on table entries conversion, see Converting theProfitability Segments below.
            Lock Operating Concern (for 'Update Run' option):
            This option is only relevant for update runs. It locks the oldoperating concerns and the new active operating concern againstpostings. Users trying to post data to these operating concerns receiveanappropriate error message.
            Call up Derivation in New Active Operating Concern:
            This option makes it possible to derive the converted characteristicsvector in the new active operating concern again (see Converting theProfitability Segments below).
            Check Characteristics in the New Active Operating Concern:
            This option makes it possible to carry out a validity check of thecharacteristic value for the converted characteristics vector in the newactive operating concern (see Converting the Profitability Segments
            below).
            User Exit for Field Assignment:
            This option makes it possible to create the characteristic assignmentbetween old operating concerns and a new active operating concernindividually using a user exit (see Converting the ProfitabilitySegments below)
            'Identification':
            This option is only available if the selection option
            User Exit for Field Assignment has been set. It makes it possibleto uniquely identify the user exit.
            Converting the Profitability Segments:
            This section describes the logic applied for transferring aprofitability segment created in an 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. This applies for entries in table CE4XXXX_FLAG as ofSAP 4.6C.
            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 the MOVE-CORRESPONDINGstep. Fields in the new active operating concern that have already beenfilled using the MOVE-CORRESPONDING logic can be changed subsequently inthe exit. Even converted entries in table CE4XXXX_FLAG can be adjustedin this exit as of SAP 4.6C.
            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 FieldAssignment indicator has to be set. A three-character abbreviationthen needs to be entered in the Identification field adjacent tothis indicator.
            The exit logic is implemented in the form routine FORM of the programREPORT. The form routine transfer parameters are the followingparameters in the order given here, in which the last three parametershave only been available since SAP 4.6C:
            • Old operating concern

            • New active operating concern

            • ID for the 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 for the old operating concern: The
                • characteristics vector is transferred in the structure CE4XXXX, whereXXXX designates the old operating concern.
                  • Characteristics vector for the new active operating concern after the
                  • MOVE-CORRESPONDING step: The characteristics vector is transferred inthe structure CE4YYYY, where YYYY designates the new active operatingconcern.
                    • Indicator specifying whether an entry in table CE4XXXX_FLAG has been
                    • found, where XXXX designates the old operating concern.
                      • Entry from table CE4XXXX_FLAG in the old operating concern: the entry is
                      • transferred in structure CE4XXXX_FLAG, where XXXX designates the oldoperating concern.
                        • Entry from table CE4YYYY_FLAG in the new active operating concern after
                        • the MOVE-CORRESPONDING step: The entry is transferred in the structureCE4YYYY_FLAG, where YYYY designates the new active operating concern.
                          Example
                          If
                          • 'S001' stands for the old operating concern

                          • 'IDEA' for the new active operating concern

                          • 'ABC' for the ID 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 shown below. As the characteristic Customer is a fixedcharacteristic of every operating concern, an entry from tableCE4S001_FLAG, for which the characteristic Customer had been assignedmanually, would already have been transferred by the MOVE-CORRESPONDINGstep in the entry for table CE4IDEA_FLAG, meaning no changes would needto be made in the exit.
                            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 MODIFY_CHARACTERISTICS
                            CHANGING I_ERKRS_OLD LIKE TKEBB-ERKRS
                            I_ERKRS_NEW LIKE TKEBB-ERKRS
                            I_EXITID TYPE KEDRSTEPID
                            I_EXIT_ACTIVE TYPE C
                            IS_CE4_OLD TYPE ANY
                            IS_CE4_NEW TYPE ANY
                            I_CE4FLAG TYPE C
                            IS_CE4FLAG_O TYPE ANY
                            IS_CE4FLAG_N TYPE ANY.
                            DATA: LS_CE4S001 LIKE CE4S001,
                            LS_CE4IDEA LIKE CE4IDEA.
                            CASE I_EXITID.
                            WHEN 'ABC'.
                            IF I_ERKRS_OLD = 'S001' AND I_ERKRS_NEW = 'IDEA'.
                            I_EXIT_ACTIVE = 'X'.,,,,"Activate forfurther processing
                            LS_CE4S001 = IS_CE4_OLD.
                            LS_CE4IDEA = IS_CE4_NEW.
                            IF LS_CE4S001-KNDNR = '0000001000'.
                            LS_CE4IDEA-KNDNR = '0000001001'.
                            ENDIF.
                            IS_CE4_NEW = LS_CE4IDEA.,,,,"Return characteristics of the

                            ,,,,,,,,,,,,,,"new active operating concern
                            ENDIF.
                            ENDCASE.
                            ENDFORM.
                            ....
                            No further changes are possible at this point for entries fromtable CE4XXXX_FLAG, only for the characteristic vector determined.
                            If the Call up Derivation in New Active Operating Concernindicator was selected, characteristic derivation is run in the newactive operating concern after the exit has been run for the determinedcharacteristics vector.
                            If an error occurs during characteristic derivation, a correspondinginformation message is issued in the processing mode Test Run with aProfitability Segment. In this instance, the cause of the error canbe determined by running a derivation analysis, accessible from withinthe log.
                            During thetest run or the update run, only the errormessage is written to the log. During an update run, the non-derivedcharacteristics vector can be used to determine a profitability segmentnumber in the new active operating concern. If necessary, theprofitability segments for which an error occurred could be adjusted byrealignments in the new active operating concern.
                            To run a validity check on the characteristic values, the CheckCharactecristics in the New Active Operating Concern indicator can beset. The validity check is made after calling up the exit and beforecharacteristic derivation. It only makes sense to run a validity checkon the characteristic values if the user exit is applied. Ifcharacteristic values are changed in the derivation, it checks theirexistence automatically.
                            As is the case during derivation, an error is reported as an informationmessage in the processing mode Test Run with a Profitability Segment
                            . During the test run or the update run, only the errormessage is written to the log. In these last two cases, the programcontinues processing in spite of the error messages.
                            Profitability Segment Selection:
                            This option is only available for the mode Test Run with a Profitabi
                            lity Segment. Here it is possible to enter a profitability segmentnumber for an old operating concern, and the existence of the number ischecked automatically.
                            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 concerns. This can be increasedmanually.

                            Processing Steps (for the 'Test Run' and 'Update Run' options)
                            Execute the program for the selected combination of old operatingconcerns, new active operating concern, and also the correspondingadditional options, initially for step A below, and then for the nineapplications also detailed below under step B.
                            Step A:,,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. The program saves the newnumber range status, as this is required for the restart option shouldthe program terminate due to database problems, for example. Newpostings in the new active operating concern would as a result be givenprofitability segment numbers that are higher than this reset numberrange status.
                            Step B:,,Billing Documents
                            ,,Sales Documents
                            ,,Deliveries
                            ,,Financial Accounting
                            ,,Settlement Rules
                            ,,Controlling
                            ,,Materials Management
                            ,,Profit Center Accounting
                            ,,Other Tables
                            On the program selection screen, those database tables that are beingconverted are specified after the names of the nine applications justlisted. Only one of the listed applications can be processed at a timein a program run.
                            The program selects all records with profitability segment in field
                            PAOBJNR from the relevant table where the profitability segmentnumber is between one and the new number range status for objectCOPA_OBJ set in step A in the new active operating concern. This issufficient, as lines with higher profitability segment numbers mustalready have been created in the new active operating concern.
                            The field PAOBJNR is converted for each document table. Moreover,the program

                            • field REC_OBJNR1 (Object number for settlement receiver) in table
                            • COBRB, where the settlement rules are stored, as well as SORT
                              ('Settlement rule sort field') in table COBRA, where theheader entries for the settlement rules are stored
                              • field COOBJNR ('Object number') in table AUAA, where the
                              • settlement documents are stored
                                For Profitability Analysis, these fields contain objects with the form'EOXXXXYYYYYYYYYY'. In this instance XXXX designates the operatingconcern and YYYYYYYYYY the profitability segment number. FieldCOBRB-REC_OBJNR1 is used to make it possible to read the text of asettlement receiver from this master record. COBRA-SORT is used in adisplay report for settlement rules. AUAA-COOBJNR contains the receiverobject of a settlement document and is used, for example, for thereversal of settlements.
                                If the program terminates in step B, it can be restarted with thesame selections. This is possible, because new postings to the newactive operating concern are given profitability segment numbers thatare higher than the new number range status set in step A, and becausethis also applies to profitability segments already converted withprogram RKE_CHACO_PAOBJNR_1.
                                The conversion status for each of the steps is displayed on theprogram selection screen as a traffic light next to the steps.These display the status for the relevant step and a special combinationof old operating concerns and new active operating concern. If thetraffic light is
                                • green, an update run has already been successfully carried out

                                • yellow, a test run has already been successfully carried out, but
                                • not 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 oveview screen that appears, you can select the status records tobe deleted as in the program selection screen corresponding to the areasOperating Concerns, Control Parameters and ProcessingSteps. Confirm the confirmation prompt that appears with Yes .

                                    Step 7
                                    If required, you can remove the old customizing assignments once theconversion has been performed completely and successfully by choosingthe menu path
                                    ,,Extras -> Display Old Customizing Assignments.
                                    This is not, however, a requirement.

                                    Step 8
                                    There are different methods for processing the profitabilitysegments and transaction data already posted in the oldoperating concerns.
                                    If costing-based Profitability Analysis is active in the oldoperating concerns and the new active operating concern, you can copythe costing-based transaction data from the old operatingconcerns to the new active operating concern using program COPA_COPY
                                    .
                                    Nevertheless, the profitability segments and costing-basedtransaction data can be retained in the operating concerns, shouldyou still need to execute reports on the data already posted.
                                    If the costing-based transaction data is to be deleted from the oldoperating concerns, you can use the CO-PA archiving tool with the object
                                    COPA1_XXXX, where XXXX designates the relevant old operatingconcern.
                                    In addition, if account-based Profitability Analysis is active inthe old operating concerns and the new active operating concern, you canconvert the account-based data from the old operating concerns tothe new active operating concern using program RKE_CHACO_PAOBJNR_2

                                    If you also want to delete the profitability segments concerned from theoperating concerns, you can also do this using the CO-PA archiving toolby implementing SAP Note 383728. However, you should only do thisonce programs COPA_COPY and RKE_CHACO_PAOBJNR_2 have been run (if thisis necessary).

                                    ,,Case 2
                                    This case can be treated in the same way as case 1. The onlydifference is that steps 2 through 5 do not apply. In this case, theoption New Active Operating Concern Not Yet Assigned should beselected in the selection screen for the program. Once theconversion has been performed successfully, steps 4 and 5 can be carriedout.