P_COMfgOrderPlanStdCube1

DDL: P_COMFGORDERPLANSTDCUBE1 SQL: PMFGORDPLNSTDCU1 Type: view COMPOSITE

P_COMfgOrderPlanStdCube1 is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_Ledger, I_FinancialPlanningEntryItem, I_MfgOrdPlngCat) and exposes 16 fields with key fields ControllingObject, ControllingObjectForOutput, ControllingDebitCreditCode, PlanningCategory, OrderID.

Data Sources (3)

SourceAliasJoin Type
I_Ledger _Ledger inner
I_FinancialPlanningEntryItem _PlanningEntryItem from
I_MfgOrdPlngCat _PlngCat inner

Parameters (2)

NameTypeDefault
P_FromFiscalYearPeriod fis_jahrper
P_ToFiscalYearPeriod fis_jahrper

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PMFGORDPLNSTDCU1 view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.buffering.status #NOT_ALLOWED view
Metadata.ignorePropagatedAnnotations true view
VDM.private true view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.dataClass #TRANSACTIONAL view

Fields (16)

KeyFieldSource TableSource FieldDescription
KEY ControllingObject
KEY ControllingObjectForOutput
KEY ControllingDebitCreditCode ControllingDebitCreditCode
KEY PlanningCategory I_FinancialPlanningEntryItem PlanningCategory
KEY OrderID OrderID
KEY OrderItem OrderItem
KEY CostSourceUnit CostSourceUnit
KEY GlobalCurrency GlobalCurrency
KEY CompanyCodeCurrency CompanyCodeCurrency
KEY FiscalYearPeriod FiscalYearPeriod
CompanyCode CompanyCode
Plant Plant
ProducedProduct ProducedProduct
IsLotSizeIndependent IsLotSizeIndependent
PlngCatIsForOrdReltdPlnCost PlngCatIsForOrdReltdPlnCost
PlngCatIsForMatlCostEstPlnCost PlngCatIsForMatlCostEstPlnCost
@AbapCatalog.sqlViewName: 'PMFGORDPLNSTDCU1'
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@VDM.private:true
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
//@EndUserText.label: 'Plan and Standard Costs Cube for Manufacturing Orders'

//Planning category to distinguish order plan costs and standard costs

//No fiscal year period restricition, for target costs calculation


define view P_COMfgOrderPlanStdCube1
  with parameters
    P_FromFiscalYearPeriod : fis_jahrper,
    P_ToFiscalYearPeriod   : fis_jahrper

  as select from I_FinancialPlanningEntryItem as _PlanningEntryItem
    inner join   I_Ledger                     as _Ledger on _PlanningEntryItem.Ledger = _Ledger.Ledger and _Ledger.IsLeadingLedger = 'X'  
    inner join   I_MfgOrdPlngCat              as _PlngCat on _PlanningEntryItem.PlanningCategory = _PlngCat.PlanningCategory
{
  key   '' as   ControllingObject,
  key   '' as   ControllingObjectForOutput, 
  key   ControllingDebitCreditCode,
  key   _PlanningEntryItem.PlanningCategory, // plan cost & standard cost category

  key   OrderID,
  key   OrderItem,
        //units

  key   CostSourceUnit,
  key   GlobalCurrency,
  key   CompanyCodeCurrency,
        //        Lot-size independent indicator for target cost calculation

  key   FiscalYearPeriod,
        CompanyCode,
        Plant,
        ProducedProduct,
        IsLotSizeIndependent,

        PlngCatIsForOrdReltdPlnCost,
        PlngCatIsForMatlCostEstPlnCost,

        sum(case when ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L'
              then AmountInGlobalCurrency
              else 0
        end)                                                                                 as   CreditPlanCostInGlobalCrcy,
        sum(case when ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S'
                then AmountInGlobalCurrency
                else 0
        end)                                                                                 as   DebitPlanCostInGlobalCrcy,
        sum(case when ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L'
              then FixedAmountInGlobalCrcy
              else 0
        end)                                                                                 as   CreditPlanFxdCostInGlobalCrcy,
        sum(case when ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S'
                then FixedAmountInGlobalCrcy
                else 0
        end)                                                                                 as   DebitPlanFxdCostInGlobalCrcy,
        sum(case when ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L'
              then AmountInCompanyCodeCurrency
              else 0
        end)                                                                                 as   CreditPlanCostInCoCodeCrcy,
        sum(case when ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S'
                then AmountInCompanyCodeCurrency
                else 0
        end)                                                                                 as   DebitPlanCostInCoCodeCrcy,
        sum(case when ControllingDebitCreditCode = 'A' or ControllingDebitCreditCode = 'L'
              then case
              when AmountInGlobalCurrency <> 0
                 then cast( round(cast(division(FixedAmountInGlobalCrcy, AmountInGlobalCurrency, 6) as abap.dec(14, 6))  //fixed amount is always less than total amount here

                            * AmountInCompanyCodeCurrency, 2)
                          as abap.curr(23, 2) )
                 else 0
              end
            else 0
            end )                                                                            as   CreditPlanFxdCostInCoCodeCrcy,
        sum(case when ControllingDebitCreditCode = 'H' or ControllingDebitCreditCode = 'S'
              then case
              when AmountInGlobalCurrency <> 0
                 then cast( round(cast(division(FixedAmountInGlobalCrcy, AmountInGlobalCurrency, 6) as abap.dec(14, 6))  //fixed amount is always less than total amount here

                            * AmountInCompanyCodeCurrency, 2)
                          as abap.curr(23, 2) )
                 else 0
              end
            else 0
            end )                                                                            as   DebitPlanFxdCostInCoCodeCrcy

}
where
  (
          AccountAssignmentType          =  'OR'
    or    AccountAssignmentType          =  'OP'
  )
  and     OrderID                        <> ''
group by
  AccountAssignmentType,
  OrderID,
  OrderItem,
  ControllingDebitCreditCode,
  _PlanningEntryItem.PlanningCategory,
  CostSourceUnit,
  GlobalCurrency,
  CompanyCodeCurrency,
  FiscalYearPeriod,
  IsLotSizeIndependent,
  PlngCatIsForOrdReltdPlnCost,
  PlngCatIsForMatlCostEstPlnCost,
  CompanyCode,
  Plant,
  ProducedProduct
  
  
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_FINANCIALPLANNINGENTRYITEM",
"I_LEDGER",
"I_MFGORDPLNGCAT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/