APO and ECC have different approaches to the calculation of time and capacity in a production order.

These may create different results for the same order when complex calculations or variant configuration are used, confusing the users and – in extreme cases – making a good APO plan unfeasible when dropped to ECC.

This article explains these differences in detail and explore options to align the APO calculation to the calculation done in ECC.

# How ECC calculates

The core of the ECC calculation for an operation’s time, capacity and cost is the formula assigned to the workcentre. The formula calculates based on parameters that take their values from the order, the operation standard values (usually copied from the routing) and the workcentre itself in the form of workcentre constants.

The most generic formula for a workcentre is the linear formula shown below. It has both a proportional term and a fixed term.

It uses standard SAP parameters that translated to their description would be:

Where the standard value 1 is the proportional time and standard value 2 is the fixed time.

For example, let’s assume a process that requires 5 min to set the operation and 3 minutes to process 1,000 units.

The time calculated for an operation for 30,000 units would be:

30,000 units / 1,000 units x 3 min + 5 min = 95 min

The formula can work for any workcentre with any combination of proportional and fixed time, including workcentres where the time is fixed regardless of the operation quantity (e.g. an oven).

The standard approach covers many requirements but cannot handle more complex situations as is the case with nonlinear formulas or when additional parameters are involved. Nonlinear formulas require functions that are not supported by workcentre formulas. Sin(x). Log(x) and X^{n} are some examples. The use of tables to determine a formula parameter is also nonlinear.

When used Variant Configuration (VC) the configured values for a specific order or product can be used to alter the calculations as well. Dimensions like length and surface are typical examples, for example the diameter in a pipe cutting operation.

ECC can accommodate these complex requirements with two functionalities: CAPP standard value calculation and Variant Configuration object dependencies.

## CAPP Standard Value Calculation

This functionality uses formulas and rules based on characteristics values from different origins to modify the standard values of the operation. The calculation can be complex, using math functions or reference tables to determine the standard value for specific operation parameters. The standard value is then used in a regular work centre formula to determine times, capacity requirements and costs.

CAPP is being superseded by Variant Configuration (VC) as it covers the same requirement with additional advantages, like compatibility with APO’s Characteristics Dependent Planning (CDP).

## Variant Configuration Object Dependencies

Variant configuration is a powerful functionality that is normally used to produce orders for customer specific requirements, for example a particular colour or cruise control option in a basic car model, in order to handle the exponential number of combinations without the need of a material record for each. Regular materials can also adopt VC functionality in order to reduce the BOM and routing master data with the use of “Super” BOMs and routings that are shared by many materials but are dynamically modified to adapt to the material or specific order characteristics.

A third use for this functionality, and the one related to the subject of this article, is to allow a more accurate calculation using parameters from multiple sources and complex formulas to modify the standard values copied from the routing into the order, as CAPP does. In addition to standard values ODs can also access and modify directly an extended number of fields both in ECC and APO.

There are different kinds of Object Dependencies but the ones used to determine the standard values (procedures) are scripts that can have conditionals, arithmetic operations and math functions. They can also determine values using reference tables or call ABAP functions. With all these options, ODs can handle complex calculations of time and capacity with accuracy. Accuracy is important in this case as small differences can accumulate to significant variations for large order quantities.

The following diagram shows ECC’s approach to the operation calculations.

**A Configuration Example**

Suppose there is an operation to cut a pipe to a specific length from a continuous supply. The time required to process each pipe is a combination of the time to move it into place, that depends on the length, and the time required to cut it that we assume is proportional to the square of the diameter.

Processing Time = A x Length + B * Diameter^{2}

Where A and B are standard values that depend on the machine and material.

The diameter and length value are coming from characteristics configured in the material master if there is a limited number of length cuts. Alternatively, the length may be defined during sales order entry and transferred to the customer segment, making possible to produce a pipe of any length without having an extremely large number of material records.

We can use the OD to copy the values of length and the diameter squared into two of the remaining standard values (2 of 6 already used by A and B), then use a simple workcentre formula to calculate the operation duration or capacity using these 4 values.

# How APO Calculates

APO calculate times and capacities in a simpler way. The formula is already predefined in the operation and is a linear formula of the kind explained at the beginning of this article. It has a variable term and a fixed term. You can see them for the duration of the operation (expressed in seconds) in the mode tab for the resource:

In APO there are **no standard values** and the duration formula is predefined for the operation as:

Duration = Dur.(V) * Operation Qty / Base Qty + Dur.(F)

The capacity works in a similar way.

APO can work with variant configuration and object dependencies as well. In APO the equivalent to Variant Configuration (VC) is the Characteristic Dependent Planning (CDP) functionality.

In APO the object dependency con modify the fixed and variable terms used in the predefined linear formula. It can also modify the duration and capacity result fields directly. This assume the use of Production Data Structures (PDS) that are compatible with object dependencies and supposed to be substituting the previous SAP approach to routings in APO (PPMs).

# Deriving the Variable (V) and Fixed (F) terms for APO

If the operation has a linear formula in ECC the standard functionality has no issue delivering an accurate calculation in APO even if the approach is different in the two systems.

To do this the system takes a couple of results from the ECC formula (for example for 0 and 100 units). With those 2 points the line is defined and the variable and fixed terms for the duration in APO can be calculated. So, regardless of the complexity of the formula the calculation is perfectly replicated in APO if the ECC formula is lineal.

This approach is not good for non-linear formulas as APO tries to replicate them with a linear approximation. The error incurred by this approximation can be better explained with an example.

Let’s assume following non-linear ECC formula, with terms are in seconds for simplicity.

Duration = 5 + 10 * Quantity^{2}

This generates the following variant and fixed terms in APO.

Calculating the ECC and APO durations for different quantities shows the variances in the result.

The difference is substantial. Graphing the formulas is clear that the two give the same result in the two points used by the system to calculate the APO linear terms (0 and 1,000 units).

This example may be exaggerated and unrealistic but it clearly shows the problem of non-linear ECC formulas when approximated by APO linear terms.

# Solution Options

The way the calculations in ECC and APO can be aligned will depend on the specifics of the situation and how close you can keep to the standard. A flexible solution is usually a better approach but a hardcoded approach can also work well if the requirement is stable and well defined.

A logical place to adjust the calculation is in the BAdI at the creation of the order in APO, which allows the adjustment of the duration and capacities before the order is saved in LiveCache (/SAPAPO/RRP_SRC_EXIT method RRP_USEX_PLORD_CREATE).

It may be tricky when variant configuration and object dependencies are involved in the calculation but the functionality offers additional options to the point that you may want to consider using VC and ODs even if the material doesn’t need to be configured from the sales point of view.

In very general terms the idea is to put the complex part of the calculation in the object dependency instead of the work centre formula and use reference characteristics to get the parameters values for the formula. The object dependency is transferred to APO as a procedure in the PDS and the parameters can be passed between systems as part of the configuration.

The approach works as long as a few complications are resolved.

- The characteristics for parameters and results have to reference different fields in ECC than in APO as their internal structures are different: SAP offers a configuration table to map fields in ECC with their equivalent fields in APO. This can also be done manually after the reference characteristics are transferred to or created in APO as long as it is before they are used there.

- The object dependency is copied “as is” from ECC into a procedure in APO but sometimes it makes sense to have a different version of the formula in each: A trick can be used in this case to include two different formulas in the same object dependency. The result characteristic of the first formula references a field in ECC but no field in APO. The second formula result points to a valid field in APO but no field in ECC. Both formulas are calculated in both systems but ECC gets the result from the first and APO from the second.

- Standard values are not transferred to APO and they cannot be passed as configuration since the configuration is for the whole order and the standard values can be different for each operation: The blunt and simple way of solving this is to include the standard values as numeric values in the object dependency. This means a different object dependency for each different combination of standard values, making maintenance of the values difficult as mass tools like LSMW or the Engineering Workbench cannot be used to change the values. I designed a solution that uses a BAdI to modify the object dependency when the PDS is being transferred to APO. It substitutes in the object dependency formula the characteristics referencing standard values with their numerical value for that specific operation. This approach uses a single object dependency while allowing mass change of the standard values in ECC. The values in the APO procedure are updated when the PDS is retransferred with CURTO_CREATE.

For historical reasons it has always been difficult to align ECC and APO – the CIF wouldn’t exists otherwise – and the way they calculate is no exception. By understanding their approach, and with a little bit of work, it is possible to get them to speak the same numbers even for the most complex cases. Theirs a estrange feeling of satisfaction when they do.

(This post was first published on the author’s professional blog, see profile)