@AbapCatalog.sqlViewName: 'IFIWCPRODCSTCUB'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: 'Production Cost By Work Center'
@VDM.viewType: #COMPOSITE
@Analytics: { dataCategory: #CUBE}
@Metadata.allowExtensions:true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED
@ClientHandling.type: #CLIENT_DEPENDENT
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.representativeKey: 'WorkCenterInternalID'
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
define view I_WorkCenterProdCostCube
with parameters
P_FromFiscalYearPeriod : fins_fyearperiod,
P_ToFiscalYearPeriod : fins_fyearperiod,
@Environment.systemField: #SYSTEM_LANGUAGE
P_Language : sylangu,
P_CurrencyRole : fac_crcyrole
as select from I_WorkCenterProductCost (
P_FromFiscalYearPeriod : $parameters.P_FromFiscalYearPeriod,
P_ToFiscalYearPeriod : $parameters.P_ToFiscalYearPeriod,
P_PlanningCategory : 'PLANORD01',
P_CurrencyRole : $parameters.P_CurrencyRole
) as _Cost
inner join I_Ledger as _Ledger on _Cost.Ledger = _Ledger.Ledger
and _Ledger.IsLeadingLedger = 'X'
{
key WorkCenterInternalID,
@ObjectModel.foreignKey.association: '_ProdnOrdOp'
key OrderOperation,
@ObjectModel.foreignKey.association: '_CtrlgOrder'
key OrderID,
@ObjectModel.foreignKey.association: '_GLAccount'
key GLAccount,
@ObjectModel.foreignKey.association: '_Material'
key Material,
@ObjectModel.foreignKey.association: '_Plant'
key Plant,
@ObjectModel.foreignKey.association: '_CostCenter'
key PartnerCostCenter,
@ObjectModel.foreignKey.association: '_ActivityType'
key PartnerCostCtrActivityType,
@ObjectModel.foreignKey.association: '_CompanyCode'
CompanyCode,
WorkCenter,
cast(COALESCE(_Material._Text[1: Language = $parameters.P_Language].MaterialName, '') as fis_material_text) as MaterialName,
_Plant.PlantName,
@ObjectModel.foreignKey.association: '_ControllingArea'
ControllingArea,
cast( _ControllingArea.ControllingAreaName as fis_bezei preserving type ) as ControllingAreaName,
cast( _CompanyCode.CompanyCodeName as fis_butxt preserving type ) as CompanyCodeName,
BusinessArea,
ProfitCenter,
_GLAccount.ChartOfAccounts,
@Semantics.text:true
OrderDescription,
OrderCategory,
OrderType,
ReferenceOrder,
MfgOrderHasMultipleItems,
// Requested by D020376 because of incompatible change when upgrade, will be deleted in further release
'' as ControllingObjectStatus,
cast(MRPPlant as fis_co_pwerk) as MRPPlant,
@Semantics.unitOfMeasure:true
UnitOfMeasure,
// Currencies
// @Semantics.currencyCode: true
// cast( case $parameters.P_CurrencyRole
// when '20' then GlobalCurrency
// else CompanyCodeCurrency
// end as cficuky ) as DisplayCurrency,
@Semantics.currencyCode:true
@UI.hidden: true
DisplayCurrency,
// plan costs
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'DisplayCurrency'} }
DebitPlanCostInDspCrcy,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'DisplayCurrency'} }
DebitPlnFxdCostInDspCrcy,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'DisplayCurrency'} }
DebitPlnVarblCostInDspCrcy,
// actual costs
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'DisplayCurrency'} }
DebitActlCostInDspCrcy,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'DisplayCurrency'} }
DebitActlFxdCostInDspCrcy,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'DisplayCurrency'} }
DebitActlVarblCostInDspCrcy,
// Actual - Plan Deviation
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'DisplayCurrency'} }
DebitActlPlnDiffCostInDspCrcy,
// Requested by D020376 because of incompatible change when upgrade, will be deleted in further release
@DefaultAggregation: #NONE
cast( '0' as fis_dr_cocrcy_actlplndiffpct ) as DebitActlPlanDiffPercent,
//Quantity
@DefaultAggregation: #SUM
@Semantics: { quantity : {unitOfMeasure: 'UnitOfMeasure'} }
ActualQtyInCostSourceUnit,
@DefaultAggregation: #SUM
@Semantics: { quantity : {unitOfMeasure: 'UnitOfMeasure'} }
PlanQtyInCostSourceUnit,
@DefaultAggregation: #SUM
@Semantics: { quantity : {unitOfMeasure: 'UnitOfMeasure'} }
ActlPlanDiffQuantity,
cast(COALESCE(_WorkCenter._Text[1: Language = $parameters.P_Language].WorkCenterText, '') as workcentertext) as WorkCenterText,
cast(COALESCE(_GLAccount._Text[1: Language = $parameters.P_Language].GLAccountName, '') as txt20_skat) as GLAccountName,
cast( _CostCenter[1:ValidityStartDate <= $session.system_date and ValidityEndDate >= $session.system_date]._Text[1: Language = $session.system_language].CostCenterName as fis_kostl_name ) as CostCenterName,
cast( _CostCenter[1:ValidityStartDate <= $session.system_date and ValidityEndDate >= $session.system_date]._Text[1: Language = $session.system_language].CostCenterDescription as fis_kostl_ltext ) as CostCenterDescription,
cast( _ActivityType[1:ValidityStartDate <= $session.system_date and ValidityEndDate >= $session.system_date]._Text[1: Language = $session.system_language].CostCtrActivityTypeName as ktext ) as CostCtrActivityTypeName,
cast( _ActivityType[1:ValidityStartDate <= $session.system_date and ValidityEndDate >= $session.system_date]._Text[1: Language = $session.system_language].CostCtrActivityTypeDesc as ltext ) as CostCtrActivityTypeDesc,
cast( case OrderCategory
when '10' then _ProdnOrdOp.OperationDescription
when '40' then _ProcOrdOp.OperationDescription
else '' end as ltxa1) as OperationDescription,
//Order Type Description
_OrderType._Text[1: Language = $parameters.P_Language].OrderTypeName as OrderTypeName,
_CtrlgOrder,
_ControllingArea,
_CompanyCode,
_WorkCenter,
_Material,
_GLAccount,
_CostCenter,
_ActivityType,
_Plant,
_ProdnOrdOp,
_ProcOrdOp
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_COSTCENTER",
"I_COSTCENTERACTIVITYTYPE",
"I_COSTCENTERACTIVITYTYPETEXT",
"I_COSTCENTERTEXT",
"I_GLACCOUNT",
"I_GLACCOUNTTEXTINCOMPANYCODE",
"I_LEDGER",
"I_MATERIAL",
"I_MATERIALTEXT",
"I_ORDERTYPE",
"I_ORDERTYPETEXT",
"I_PLANT",
"I_PROCESSORDEROPERATION",
"I_PRODUCTIONORDEROPERATION",
"I_WORKCENTER",
"I_WORKCENTERPRODUCTCOST",
"I_WORKCENTERTEXT"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_COSTCENTER",
"I_COSTCENTERACTIVITYTYPE",
"I_GLACCOUNT",
"I_MATERIAL",
"I_PLANT",
"I_PROCESSORDEROPERATION",
"I_PRODUCTCOSTCTRLGORDER",
"I_PRODUCTIONORDEROPERATION",
"I_WORKCENTER"
],
"BASE":
[
"I_WORKCENTERPRODUCTCOST"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/