How to resolve CK466 error during confirmation production order
Hi guys, this is my first blog in the community here. This time I will share my experiance for resvoling CK466 error which puzzled me a lot once before. I was serach CK466 in this community and found quite often questions casued by missing activity price in KP26. In this case, you can use COFC to postprocess the CO document when you update price without reverse previouse confirmation.
However still some CK466 casued by mistical reason behind. The solution given by the blog is not only valid for CK466 also valid for other CK errors during confirmation process.
Once we confirm the order, the correspondence CO document will be generated at the same time. The following prerequisites must be fulfilled for logistics so that Controlling documents (CO documents) can be created during a confirmation:
- The order must have a costing variant for actualcosts (field CAUFVD-KLVARI).
- The confirmed operation must be relevant to costing (T430-KALKZ = “X”). This indicator is set in the operation control key.
- The order itself must have the “fully relevant to costing” attribute set (AFVGD-SELKZ = “X”). This indicator is copied from the routing and cannot be changed in the production order. For this, refer to SAP Note 378052, if necessary.
- The confirmed operation must have a work center.
- The work center must be assigned to a valid cost center.
- In the work center, a valid activity type as well as a formula must be defined for every activity whose costs you want to determine.
- These activity types also have to be specified accordingly in the order operation.
- For the activity types used in the work center, the prices must be maintained for the cost centers of the work center (transaction KP26).
- The confirmed operation must not be an external processing operation.
- During the confirmation, you must enter activities.
For example,CK466 error occurred may due to different reason, one of them is due to plan price set too small.
e.g.cost center1074502 with activity type 74RM1 in 2016 01, the price in object currency is CNY 0.05. With the exchange rate, the price in controlling area is CHF 0. This will cause error CK466 happens
Then you can use either transaction CO1P or the report CORUPROC to post CO document.
The other reason may due to activity type is changed or of which valid date is not fitable. For example, the valid period of activity type defined in work center is bellowing:
However, the order planning cost was occured during order creation on 16-Dec-2015
As a result, no valid activity type is copied into order :
The planning cost of order had no value of activity. During the confirmation, the CK466 occured due to no valid actitity type used. You can apply SAP note 162906 which is forced that during the determination of actual costs in general the activity type of the work center valid for the posting date is used. Thus, the activity documented in the activities of the order is used only for the standard cost estimate but not for the actual costing.
How to find out root cause of actual costing errors and resolve it? You can check the following
- Have errors occured in the actual-cost calculation for the confirmation? If this is the case, you must use transaction COFC to postprocess the incorrect records. The table AFRC contains the incorrect records.
- The actual-cost calculation may be processed separately from the confirmation. You can set this separation in the Customizing for the confirmation (transaction OPK4). You can enter a process control key in the “Process Control” field to specify that the actual costs are to be calculated in the background. If this is the case, the system writes only future change records to the table AFRP3 for the confirmation. You can use either transaction CO1P or the report CORUPROC to post these future change records. However, a decoupling of the actual costs is not possible in case of:
- Run schedule header
- Header confirmation
If errors occur in this case, error records are again created for them for the reprocessing.
If you want to change CO document posting date due to some reason, you shall use program ‘ZAFRC’ to further process.
Program ‘ZAFRC’ provides the following functions:
- Issuing errors of the calculation of actual costs in a list. Every error occurred is listed only once.
- Transferring error records into an indicator table and deleting the error records.
- Changing the posting date in the confirmation.You should only use this option if error records of the calculation of actual costs are in the blocked posting periods.
You can execute program ZAFRC in the test mode (parameter ‘TESTRUN’). No database changes are made in this mode.
The number of the records to be edited can be entered into parameter ‘NUMBER’. On the one hand, you can divide into portions, on the other
hand, you can test with a small dataset (for example, 1) first. This procedure is highly recommended by SAP!
If you want to change the posting date, you must enter the new posting date into parameter ‘PDAT_NEW’. All records are changed for which
its date is before the date entered into parameter ‘PDAT_TO’. We recommend to select the date in field ‘PDAT_TO’ so that every earlier date falls into a
completed posting period. You must always enter parameters ‘PDAT_NEW’ and ‘PDAT_TO’ together. Remark: the changing of the posting date has no effect on the reprocessing of failed goods movements via Transaction COGI. After run, the new posting date will be update:
If all costs errors are issued in a list, you must enter parameter ‘PROTOCOL’.
You can restrict the processing to certain order types (for example, network) via parameter ‘ORDERTYP’
3.Have you changed activity types or the work center of the confirmed operation after releasing the order? When you create an order, the system copies activity types that are valid at this time from the work center. Nevertheless, if you create confirmations at a point in time at which the validity is expired or work center data was changed manually, the determination of actual costs occurs with the original activity types in the order. Therefore, the confirmed activities are either incorrectly valuated, or a valuation cannot occur because the activity type is no longer valid in the meantime.
You can subsequently update the data if you change (and save) the work center in the production order for a short time and immediately reset it
to the original work center. The subsequent confirmation then generates the updated data and activities.
If confirmations were made for the wrong activity types then you must take account of the following:
In general the confirmations should be cancelled in the production order before the work center is changed. The work center is then updated using the procedure mentioned above. Then the confirmations have to be created again.
If confirmations have mistakenly been created for activities for which no costs have been calculated – for example because no activity types
were maintained in the work center – then the confirmations must be cancelled before changing the work center in the production order! Otherwise when you
cancel the confirmations negative costs are generated! Only then can the confirmations be created with the corrected activities.
4.If you confirmed to a different work center than you have planned, this work center would be proposed for this operation during all further confirmations. For example, if no activity types are assigned to this work center, no costs will be posted during the confirmation although costs could have been planned.
5.Have you changed the attributes of an operation control key involved in the Customizing after creating an order? Example: When
you create an order, an operation is not relevant to costing because of its operation control key. This is noted in the operation data (AFVC-SELKZ = ” “). If you change the operation control key in the Customizing afterwards so that it is relevant to costing, this information cannot be transferred to the orders involved. If you enter a confirmation for the corresponding order, no costs will be posted.
If you want to further check program, you can refer bellowing :
Branching from the confirmation to CO:
You call the form routine DET_CONF_COST (LCORFFD1 or LCORFF40) in the function module CO_RU_CONF_POST.
No reprocessing possible using transaction COFC:
When you enter confirmations via the time sheet (CATS), you could transfer times that are in a locked posting period. You can display these
records in transaction COFC after the transfer. For these records, you must either reopen the posting period or change the posting date in the confirmation
records as specified in SAP Note 212705 or in SAP Note 301574.
Subroutine DET_CONF_COST (LCORFF40):
- Check whether the actual costing variant is set:
* Istkostenermittlung nur wenn “Kalkulationsvariate Ist
* gesetzt” ist
CHECK NOT CAUFVD_TMP-KLVARI IS INITIAL.
- Dynamic call of CO, usually a call of function module CK_F_ACTUAL_COST_CALC
* CO-Baustein zur Kostenermittlung aufrufen
CAUFVD_IMP = CAUFVD_TMP
PROTOCOL = SPACE
NO_COSTING = 01.
Function module CK_F_ACTUAL_COST_CALC (LCK00U05):
- Repeated check whether an actual costing variant exists:
* Keine Kostenermittlung ohne Kalkulationsvariante
PERFORM CHECK_KLVAR USING CAUFVD_IMP-AUART
- Call of function module CK_F_AFRU_AMOUNT_CALC. This function module sets up the internal table KALKTAB. This table contains all activities
whose costs are to be determined.
* KALKTAB-Einträge zu Rückmeldungen generieren.
CALL FUNCTION ‘CK_F_AFRU_AMOUNT_CALC’
CAUFVD_IMP = CAUFVD_IMP
CKCOUEB_IMP = CKCOUEB_HDR
OPS_SETTEL = VORGANGSKONTIERUNG
Function module CK_F_AFRU_AMOUNT_CALC (LCK01U06):
- Check whether a work center was entered for the confirmation.
* Arbeitsplatz gesetzt ?
CHECK NOT AFRUD_TMP-ARBID IS INITIAL.
- Only take operations into account that can be determined. The “relevant to costing” indicator (T430_TMP-KALKZ) comes from the operation control key.
* Nur kalkulierbare Vorgänge
CHECK NOT T430_TMP-KALKZ IS INITIAL.
CHECK NOT AFVGD_OPR-SELKZ IS INITIAL.
- Check for external processing
* Fremdbearbeitung obligatorisch ? Oder optional und
* keine Eigenbearbeitungsdaten ? Dann abbrechen.
CHECK (T430_TMP-LIEF IS INITIAL ) OR
(T430_TMP-LIEF = ‘X’ AND
( NOT AFRUD_TMP-ARBID IS INITIAL ) ).
- Check whether the actual work center confirmed has a cost center assigned.
IF RCR01_TMP-KOSTL IS INITIAL.
CALL FUNCTION ‘CM_F_MESSAGE’
MESAGE_TYPE_NOT_VALID = 01
NO_SY_MESSAGE = 02. Der Arbeitsplatz <(>&<)> hat keine Kostenstelle RAISE NO_ENTRY.