P_PCCTgtCstForMTSOrder
Target cost for MTS Order
P_PCCTgtCstForMTSOrder is a Consumption CDS View that provides data about "Target cost for MTS Order" in SAP S/4HANA. It reads from 2 data sources (P_PCCCostEstimateItem, P_PCCOrderActualOutputQuantity) and exposes 44 fields with key fields Ledger, ControllingObject, OrderID, OrderItem, ProducedProduct.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| P_PCCCostEstimateItem | _CostEst | inner |
| P_PCCOrderActualOutputQuantity | P_PCCOrderActualOutputQuantity | from |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_FromFiscalYearPeriod | fis_jahrper | |
| P_ToFiscalYearPeriod | fis_jahrper |
Annotations (9)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PPCCTGTMTS | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| ClientHandling.type | #CLIENT_DEPENDENT | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| VDM.private | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| EndUserText.label | Target cost for MTS Order | view |
Fields (44)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | Ledger | P_PCCCostEstimateItem | Ledger | |
| KEY | ControllingObject | _ActlQty | ControllingObject | |
| KEY | OrderID | _ActlQty | OrderID | |
| KEY | OrderItem | _ActlQty | OrderItem | |
| KEY | ProducedProduct | ProducedProduct | ||
| KEY | Material | P_PCCCostEstimateItem | Material | |
| KEY | CostOriginGroup | CostOriginGroup | ||
| KEY | Plant | _ActlQty | Plant | |
| KEY | FiscalYear | FiscalYear | ||
| KEY | FiscalPeriod | FiscalPeriod | ||
| KEY | FiscalYearPeriod | FiscalYearPeriod | ||
| KEY | GLAccount | GLAccount | ||
| KEY | CompanyCode | _ActlQty | CompanyCode | |
| KEY | ControllingArea | ControllingArea | ||
| KEY | WorkCenterInternalID | WorkCenterInternalID | ||
| KEY | OrderOperation | OrderOperation | ||
| KEY | PlanningCategory | PlanningCategory | ||
| KEY | BusinessTransactionType | BusinessTransactionType | ||
| KEY | OriginCostCenter | OriginCostCenter | ||
| KEY | OriginCostCtrActivityType | OriginCostCtrActivityType | ||
| KEY | PartnerCostCenter | PartnerCostCenter | ||
| KEY | PartnerCostCtrActivityType | PartnerCostCtrActivityType | ||
| KEY | CostEstimateValidityStartDate | CostEstimateValidityStartDate | ||
| KEY | CostEstimateValidityEndDate | CostEstimateValidityEndDate | ||
| KEY | ControllingDebitCreditCode | ControllingDebitCreditCode | ||
| KEY | PartnerAccountAssignmentType | PartnerAccountAssignmentType | ||
| KEY | GlobalCurrency | GlobalCurrency | ||
| KEY | CompanyCodeCurrency | CompanyCodeCurrency | ||
| KEY | IsLotSizeIndependent | IsLotSizeIndependent | ||
| KEY | CostingLotSize | CostingLotSize | ||
| KEY | LotSizeUnit | LotSizeUnit | ||
| KEY | CostSourceUnit | CostSourceUnit | ||
| KEY | SalesOrder | _ActlQty | SalesOrder | |
| KEY | SalesOrderItem | _ActlQty | SalesOrderItem | |
| ValuationStrategy | ||||
| FreeDefinedCurrency1 | FreeDefinedCurrency1 | |||
| FreeDefinedCurrency2 | FreeDefinedCurrency2 | |||
| FreeDefinedCurrency3 | FreeDefinedCurrency3 | |||
| FreeDefinedCurrency4 | FreeDefinedCurrency4 | |||
| FreeDefinedCurrency5 | FreeDefinedCurrency5 | |||
| FreeDefinedCurrency6 | FreeDefinedCurrency6 | |||
| FreeDefinedCurrency7 | FreeDefinedCurrency7 | |||
| FreeDefinedCurrency8 | FreeDefinedCurrency8 | |||
| quan233else0endendasTotalQuantity |
@AbapCatalog.sqlViewName: 'PPCCTGTMTS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@VDM.viewType: #CONSUMPTION
@ClientHandling.type: #CLIENT_DEPENDENT
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private:true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Target cost for MTS Order'
define view P_PCCTgtCstForMTSOrder
with parameters
P_FromFiscalYearPeriod : fis_jahrper,
P_ToFiscalYearPeriod : fis_jahrper
as select from P_PCCOrderActualOutputQuantity( P_FromFiscalYearPeriod : $parameters.P_FromFiscalYearPeriod,
P_ToFiscalYearPeriod : $parameters.P_ToFiscalYearPeriod ) as _ActlQty
inner join P_PCCCostEstimateItem as _CostEst on _ActlQty.Plant = _CostEst.Plant
and _ActlQty.Material = _CostEst.ProducedProduct
and _CostEst.SalesOrder is initial
and _CostEst.SalesOrderItem is initial
and _ActlQty.PostingDate >= _CostEst.CostEstimateValidityStartDate
and _ActlQty.PostingDate <= _CostEst.CostEstimateValidityEndDate
{
key _CostEst.Ledger,
key _ActlQty.ControllingObject,
key _ActlQty.OrderID,
key _ActlQty.OrderItem,
key ProducedProduct,
key _CostEst.Material,
key CostOriginGroup,
key _ActlQty.Plant,
key FiscalYear,
key FiscalPeriod,
key FiscalYearPeriod,
key GLAccount,
key _ActlQty.CompanyCode,
key ControllingArea,
key WorkCenterInternalID,
key OrderOperation,
key PlanningCategory,
key BusinessTransactionType,
key OriginCostCenter,
key OriginCostCtrActivityType,
key PartnerCostCenter,
key PartnerCostCtrActivityType,
key CostEstimateValidityStartDate,
key CostEstimateValidityEndDate,
key case when _ActlQty.OrderItem = '0000'
then 'OR'
else 'OP'
end as AccountAssignmentType,
key ControllingDebitCreditCode,
key PartnerAccountAssignmentType,
key GlobalCurrency,
key CompanyCodeCurrency,
key IsLotSizeIndependent,
key CostingLotSize,
key LotSizeUnit,
key CostSourceUnit,
key _ActlQty.SalesOrder,
key _ActlQty.SalesOrderItem,
'' as ValuationStrategy,
FreeDefinedCurrency1,
FreeDefinedCurrency2,
FreeDefinedCurrency3,
FreeDefinedCurrency4,
FreeDefinedCurrency5,
FreeDefinedCurrency6,
FreeDefinedCurrency7,
FreeDefinedCurrency8,
sum( case when IsLotSizeIndependent = 'X'
then AmountInGlobalCurrency
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInGlobalCurrency, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInGlobalCurrency,
sum( case when IsLotSizeIndependent = 'X'
then FixedAmountInGlobalCurrency
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(FixedAmountInGlobalCurrency, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as FixedAmountInGlobalCurrency,
sum( case when IsLotSizeIndependent = 'X'
then AmountInCompanyCodeCurrency
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInCompanyCodeCurrency, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInCompanyCodeCurrency,
sum( case when IsLotSizeIndependent = 'X'
then FixedAmountInCoCodeCurrency
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(FixedAmountInCoCodeCurrency, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as FixedAmountInCoCodeCurrency,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency1
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency1, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency1,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency2
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency2, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency2,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency3
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency3, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency3,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency4
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency4, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency4,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency5
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency5, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency5,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency6
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency6, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency6,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency7
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency7, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency7,
sum( case when IsLotSizeIndependent = 'X'
then AmountInFreeDefinedCurrency8
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(AmountInFreeDefinedCurrency8, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 2) as abap.curr( 23, 2 ) )
else 0
end
end
) as AmountInFreeDefinedCurrency8,
sum( case when IsLotSizeIndependent = 'X'
then TotalQuantity
else case when ActualOutputQuantity <> 0 and CostingLotSize <> 0
then cast( round(cast(division(TotalQuantity, CostingLotSize, 6) as abap.dec(14, 6))
* ActualOutputQuantity * -1, 3) as abap.quan(23, 3) )
else 0
end
end
) as TotalQuantity
}
where
_ActlQty.SalesOrder is initial
and _ActlQty.SalesOrderItem is initial
and _ActlQty.ActualOutputQuantity <> 0
group by
_CostEst.Ledger,
_ActlQty.ControllingObject,
_ActlQty.OrderID,
_ActlQty.OrderItem,
ProducedProduct,
_CostEst.Material,
CostOriginGroup,
_ActlQty.Plant,
FiscalYear,
FiscalPeriod,
FiscalYearPeriod,
GLAccount,
_ActlQty.CompanyCode,
ControllingArea,
WorkCenterInternalID,
OrderOperation,
PlanningCategory,
BusinessTransactionType,
OriginCostCenter,
OriginCostCtrActivityType,
PartnerCostCenter,
PartnerCostCtrActivityType,
CostEstimateValidityStartDate,
CostEstimateValidityEndDate,
ControllingDebitCreditCode,
PartnerAccountAssignmentType,
GlobalCurrency,
CompanyCodeCurrency,
IsLotSizeIndependent,
CostingLotSize,
LotSizeUnit,
CostSourceUnit,
FreeDefinedCurrency1,
FreeDefinedCurrency2,
FreeDefinedCurrency3,
FreeDefinedCurrency4,
FreeDefinedCurrency5,
FreeDefinedCurrency6,
FreeDefinedCurrency7,
FreeDefinedCurrency8,
_ActlQty.SalesOrder,
_ActlQty.SalesOrderItem
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_PCCCOSTESTIMATEITEM",
"P_PCCORDERACTUALOUTPUTQUANTITY"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA