P_COPLANTARGETCUBE
CO Plan and Target Values
P_COPLANTARGETCUBE is a CDS View in S/4HANA. CO Plan and Target Values. 1 CDS views read from this table.
CDS Views using this table (1)
| View | Type | Join | VDM | Description |
|---|---|---|---|---|
| P_COOrderPlanTargetCube | view | inner | COMPOSITE | Order Plan Target Cube |
@AbapCatalog.sqlViewName: 'PFIPLANTGTCUBE'
@ClientHandling.type: #CLIENT_DEPENDENT
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
//@EndUserText.label: 'CO Plan or Target Values'
@VDM.viewType: #COMPOSITE
@VDM.private:true
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@Metadata.ignorePropagatedAnnotations: true
define view P_COPlanTargetCube
with parameters
P_PlanningCategory : fcom_category
as select from I_COPlanTargetByPeriod
{
key ControllingObject,
key FiscalYear,
key FiscalPeriod,
key FiscalYearPeriod,
key ControllingValueType,
key ControllingVersion,
key CostElement,
key ControllingKeySubNumber,
key BusinessTransactionType,
key ControllingDebitCreditCode,
key $parameters.P_PlanningCategory as PlanningCategory,
key PartnerCostObject,
key OriginSenderObject,
key CtrlgOriginClassification, //Origin Indicator
key UnitOfMeasure,
AccountAssignmentType,
OrderID,
OrderItem,
left(PartnerCostObject, 2) as PartnerAccountAssignmentType,
AmountInCtrlgAreaCrcy,
FixedAmountInCtrlgAreaCrcy,
AmountInObjectCurrency,
// AFLE Enablement: add cast as abap.curr(22, 6) around division to pass compiler
case when AmountInCtrlgAreaCrcy <> 0
then cast ( round(cast ( division(FixedAmountInCtrlgAreaCrcy, AmountInCtrlgAreaCrcy, 6) as abap.curr(14, 6) ) // AFLE enablement
* AmountInObjectCurrency, 2)
as abap.curr(23, 2))
else 0
end as FixedAmountInObjectCurrency,
TotalQuantity,
FixedQuantity,
/////////////////////////////////////////////////////////////////////////////////////
// Derive plan costs related key figures
/////////////////////////////////////////////////////////////////////////////////////
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInCtrlgAreaCrcy
else 0
end as PlanCostsCreditGlobalCurr,
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInCtrlgAreaCrcy
else 0
end as PlanCostsDebitGlobalCurr,
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then FixedAmountInCtrlgAreaCrcy
else 0
end as PlanFixedCostsCreditGlobalCurr,
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then FixedAmountInCtrlgAreaCrcy
else 0
end as PlanFixedCostsDebitGlobalCurr,
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInObjectCurrency
else 0
end as PlanCostsCreditCompCodeCurr,
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInObjectCurrency
else 0
end as PlanCostsDebitCompCodeCurr,
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then case
when AmountInCtrlgAreaCrcy <> 0
then cast ( round(cast(division(FixedAmountInCtrlgAreaCrcy, AmountInCtrlgAreaCrcy, 6) as abap.curr(14, 6) )
* AmountInObjectCurrency, 2)
as abap.curr(23, 2))
else 0
end
else 0
end as PlanFixedCostsCreditCoCodeCurr,
case when ControllingValueType = '01' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then case
when AmountInCtrlgAreaCrcy <> 0
then cast ( round(cast(division(FixedAmountInCtrlgAreaCrcy, AmountInCtrlgAreaCrcy, 6) as abap.curr(14, 6) )
* AmountInObjectCurrency, 2)
as abap.curr(23, 2))
else 0
end
else 0
end as PlanFixedCostsDebitCoCodeCurr,
case when ControllingValueType = '01'
then TotalQuantity
else 0
end as PlanQuantity,
case when ControllingValueType = '01'
then FixedQuantity
else 0
end as PlanFixedQuantity,
/////////////////////////////////////////////////////////////////////////////////////
// Derive target costs related key figures
/////////////////////////////////////////////////////////////////////////////////////
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInCtrlgAreaCrcy
else 0
end as TargetCostsCreditGlobalCurr,
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInCtrlgAreaCrcy
else 0
end as TargetCostsDebitGlobalCurr,
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInObjectCurrency
else 0
end as TargetCostsCreditCompCodeCurr,
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInObjectCurrency
else 0
end as TargetCostsDebitCompCodeCurr,
case when ControllingValueType = '05'
then TotalQuantity
else 0
end as TargetQuantity,
case when ControllingValueType = '05'
then FixedQuantity
else 0
end as TargetFixedQuantity,
/////////////////////////////////////////////////////////////////////////////////////
// Derive target WIP related key figures
/////////////////////////////////////////////////////////////////////////////////////
AmountInCtrlgAreaCrcy as TargetWIPGlobalCurr,
AmountInObjectCurrency as TargetWIPCompCodeCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInCtrlgAreaCrcy
else 0
end as TargetWIPCreditGlobalCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInCtrlgAreaCrcy
else 0
end as TargetWIPDebitGlobalCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInObjectCurrency
else 0
end as TargetWIPCreditCompCodeCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInObjectCurrency
else 0
end as TargetWIPDebitCompCodeCurr,
case when ControllingValueType = '05'
then TotalQuantity
else 0
end as TargetWIPQuantity,
case when ControllingValueType = '05'
then FixedQuantity
else 0 end as TargetWIPFixedQuantity
}
// For 04/05, the target cost in detail page will be got from GTT table.
union all select from I_COTargetCostsFromGTT
{
key ControllingObject,
key FiscalYear,
key FiscalPeriod,
key cast(concat(FiscalYear, FiscalPeriod) as fis_jahrper) as FiscalYearPeriod,
key '05' as ControllingValueType,
key ControllingVersion,
key CostElement,
key ControllingKeySubNumber,
key BusinessTransactionType,
key ControllingDebitCreditCode,
key $parameters.P_PlanningCategory as PlanningCategory,
key PartnerCostObject,
key OriginSenderObject,
key CtrlgOriginClassification, //Origin Indicator
key UnitOfMeasure,
//Derive Partner related fields
// key case PartnerAccountAssignmentType
// when 'KL'
// then substring(PartnerCostObject, 7, 10)
// when 'KS'
// then substring(PartnerCostObject, 7, 10)
// else ''
// end as PartnerCostCenter,
// key case PartnerAccountAssignmentType
// when 'KL' then substring(PartnerCostObject, 17, 6)
// else ''
// end as PartnerCostCtrActivityType,
// key case PartnerAccountAssignmentType
// when 'BP' then substring(PartnerCostObject, 7, 12)
// else ''
// end as PartnerBusinessProcess,
// key case PartnerAccountAssignmentType
// when 'OR' then substring(PartnerCostObject, 3, 12)
// when 'OP' then substring(PartnerCostObject, 3, 12)
// else ''
// end as PartnerOrder,
//
//
//
// key '' as Material,
// key '' as Plant,
// key '' as CostOriginGroup,
AccountAssignmentType,
case AccountAssignmentType
when 'OR' then substring(ControllingObject, 3, 12)
when 'OP' then substring(ControllingObject, 3, 12)
else ''
end as OrderID,
case AccountAssignmentType
when 'OR' then '0000'
when 'OP' then substring(ControllingObject, 15, 4)
else ''
end as OrderItem,
PartnerAccountAssignmentType,
AmountInGlobalCurrency as AmountInCtrlgAreaCrcy,
FixedAmountInGlobalCrcy as FixedAmountInCtrlgAreaCrcy,
AmountInObjectCurrency,
case when AmountInGlobalCurrency <> 0
then cast ( round(cast ( division(FixedAmountInGlobalCrcy, AmountInGlobalCurrency, 6) as abap.curr(14, 6) ) // AFLE enablement
* AmountInObjectCurrency, 2)
as abap.curr(23, 2))
else 0
end as FixedAmountInObjectCurrency,
TotalQuantity,
FixedQuantity,
/////////////////////////////////////////////////////////////////////////////////////
// Derive plan costs related key figures
/////////////////////////////////////////////////////////////////////////////////////
cast('0' as abap.curr(23, 2) ) as PlanCostsCreditGlobalCurr,
cast('0' as abap.curr(23, 2) ) as PlanCostsDebitGlobalCurr,
cast('0' as abap.curr(23, 2) ) as PlanFixedCostsCreditGlobalCurr,
cast('0' as abap.curr(23, 2) ) as PlanFixedCostsDebitGlobalCurr,
cast('0' as abap.curr(23, 2) ) as PlanCostsCreditCompCodeCurr,
cast('0' as abap.curr(23, 2) ) as PlanCostsDebitCompCodeCurr,
cast('0' as abap.curr(23, 2) ) as PlanFixedCostsCreditCoCodeCurr,
cast('0' as abap.curr(23, 2) ) as PlanFixedCostsDebitCoCodeCurr,
case when ControllingValueType = '01'
then TotalQuantity
else 0
end as PlanQuantity,
case when ControllingValueType = '01'
then FixedQuantity
else 0
end as PlanFixedQuantity,
/////////////////////////////////////////////////////////////////////////////////////
// Derive target costs related key figures
/////////////////////////////////////////////////////////////////////////////////////
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInGlobalCurrency
else 0
end as TargetCostsCreditGlobalCurr,
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInGlobalCurrency
else 0
end as TargetCostsDebitGlobalCurr,
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInObjectCurrency
else 0
end as TargetCostsCreditCompCodeCurr,
case when ControllingValueType = '05' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInObjectCurrency
else 0
end as TargetCostsDebitCompCodeCurr,
case when ControllingValueType = '05'
then TotalQuantity
else 0
end as TargetQuantity,
case when ControllingValueType = '05'
then FixedQuantity
else 0
end as TargetFixedQuantity,
/////////////////////////////////////////////////////////////////////////////////////
// Derive target WIP related key figures
/////////////////////////////////////////////////////////////////////////////////////
AmountInGlobalCurrency as TargetWIPGlobalCurr,
AmountInObjectCurrency as TargetWIPCompCodeCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInGlobalCurrency
else 0
end as TargetWIPCreditGlobalCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInGlobalCurrency
else 0
end as TargetWIPDebitGlobalCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L')
then AmountInObjectCurrency
else 0
end as TargetWIPCreditCompCodeCurr,
case when ControllingValueType = '06' and (ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S')
then AmountInObjectCurrency
else 0
end as TargetWIPDebitCompCodeCurr,
case when ControllingValueType = '05'
then TotalQuantity
else 0
end as TargetWIPQuantity,
case when ControllingValueType = '05'
then FixedQuantity
else 0 end as TargetWIPFixedQuantity
}
where
ControllingValueType = '05'