P_MaterialValuationPrices

DDL: P_MATERIALVALUATIONPRICES SQL: PMATVALPRICES Type: view COMPOSITE

P_MaterialValuationPrices is a Composite CDS View in SAP S/4HANA. It reads from 5 data sources (P_MlPrice_Period_By_Periodtype, R_MaterialLedgerPriceCmptblty, P_MlPrice_By_Periodtype, R_MatlPriceDataMigrationStatus, R_MatlPriceDataMigrationStatus) and exposes 81 fields with key fields CostEstimate, Ledger, CurrencyRole, FiscalYear, FiscalPeriod. It has 1 association to related views.

Data Sources (5)

Associations (1)

CardinalityTargetAliasCondition
[0..1] R_MatlLedgerValnCrcyRole _MLCurrencyInfo _MLCurrencyInfo.LedgerValuationCurrencyRole = mlper.CurrencyRole and _MLCurrencyInfo.CompanyCode = mlper.CompanyCode

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PMATVALPRICES view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (81)

KeyFieldSource TableSource FieldDescription
KEY CostEstimate P_MlPrice_Period_By_Periodtype CostEstimate
KEY Ledger
KEY CurrencyRole P_MlPrice_Period_By_Periodtype CurrencyRole
KEY FiscalYear P_MlPrice_Period_By_Periodtype FiscalYear
KEY FiscalPeriod P_MlPrice_Period_By_Periodtype FiscalPeriod
KEY PeriodType PeriodType
KEY FiscalPeriodType FiscalPeriodType
Material P_MlPrice_Period_By_Periodtype Material
ValuationArea P_MlPrice_Period_By_Periodtype ValuationArea
InventoryValuationType R_MaterialLedgerPriceCmptblty InventoryValuationType
SalesOrder SalesOrder
SalesOrderItem SalesOrderItem
Supplier Supplier
WBSElementInternalID WBSElementInternalID
WBSElementExternalID WBSElementExternalID
InvtryValnSpecialStockType InvtryValnSpecialStockType
InventorySpecialStockValnType InventorySpecialStockValnType
IsSupplierStockValuation IsSupplierStockValuation
CompanyCode CompanyCode
PriceDeterminationControl PriceDeterminationControl
MaterialPriceControl MaterialPriceControl
MaterialPriceUnitQty MaterialPriceUnitQty
Currency Currency
MovingAveragePrice MovingAveragePrice
StandardPrice StandardPrice
InventoryPrice InventoryPrice
FuturePrice FuturePrice
FuturePriceValidityStartDate FuturePriceValidityStartDate
PlannedPrice PlannedPrice
FutrCostEstValuationVariant FutrCostEstValuationVariant
FutureCostEstFiscalYear FutureCostEstFiscalYear
FutureCostEstimateFiscalPeriod FutureCostEstimateFiscalPeriod
FutureCostEstCostingVersion FutureCostEstCostingVersion
FixedPortionOfPlannedPrice FixedPortionOfPlannedPrice
LedgerName _MLCurrencyInfo LedgerName
CurrencyRoleName _MLCurrencyInfo CurrencyRoleName
LegalCurrencyRole _MLCurrencyInfo LegalCurrencyRole
LegalCurrencyRoleName _MLCurrencyInfo LegalCurrencyRoleName
AccountingValuationView _MLCurrencyInfo AccountingValuationView
AcctgValnVwSubviewCombinedName _MLCurrencyInfo AcctgValnVwSubviewCombinedName
CompanyCodekeyCostEstimate
KEY Ledger Ledger
KEY CurrencyRole CurrencyRole
KEY FiscalYear FiscalYear
KEY FiscalPeriod FiscalPeriod
KEY PeriodType PeriodType
KEY FiscalPeriodType FiscalPeriodType
Material Material
ValuationArea ValuationArea
InventoryValuationType InventoryValuationType
SalesOrder SalesOrder
SalesOrderItem SalesOrderItem
Supplier Supplier
WBSElementInternalID WBSElementInternalID
WBSElementExternalID WBSElementExternalID
InvtryValnSpecialStockType InvtryValnSpecialStockType
InventorySpecialStockValnType InventorySpecialStockValnType
IsSupplierStockValuation IsSupplierStockValuation
CompanyCode CompanyCode
PriceDeterminationControl PriceDeterminationControl
MaterialPriceControl MaterialPriceControl
MaterialPriceUnitQty MaterialPriceUnitQty
Currency Currency
MovingAveragePrice MovingAveragePrice
StandardPrice StandardPrice
InventoryPrice InventoryPrice
FuturePrice FuturePrice
FuturePriceValidityStartDate FuturePriceValidityStartDate
PlannedPrice PlannedPrice
FutrCostEstValuationVariant FutrCostEstValuationVariant
FutureCostEstFiscalYear FutureCostEstFiscalYear
FutureCostEstimateFiscalPeriod FutureCostEstimateFiscalPeriod
FutureCostEstCostingVersion FutureCostEstCostingVersion
FixedPortionOfPlannedPrice FixedPortionOfPlannedPrice
LedgerName _MLCurrencyInfo LedgerName
CurrencyRoleName _MLCurrencyInfo CurrencyRoleName
LegalCurrencyRole _MLCurrencyInfo LegalCurrencyRole
LegalCurrencyRoleName _MLCurrencyInfo LegalCurrencyRoleName
AccountingValuationView _MLCurrencyInfo AccountingValuationView
AcctgValnVwSubviewCombinedName _MLCurrencyInfo AcctgValnVwSubviewCombinedName
LedgerValnCrcyRoleIsUsedInLogs _MLCurrencyInfo LedgerValnCrcyRoleIsUsedInLogs
@AbapCatalog.sqlViewName: 'PMATVALPRICES'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@VDM.viewType: #COMPOSITE
define view P_MaterialValuationPrices
  as select from           P_MlPrice_Period_By_Periodtype as mlper
    inner join   R_MatlPriceDataMigrationStatus as tf on(
      tf.MatlPriceDataMigrationStatus                                                   = 'X'
    )
                                                      or(
                                                        tf.MatlPriceDataMigrationStatus = 'R'
                                                      )                                                                                
    inner join             R_MaterialLedgerPriceCmptblty  as mlprc      on  mlprc.CostEstimate     = mlper.CostEstimate
                                                                        and mlprc.ValuationArea    = mlper.ValuationArea
                                                                        and mlprc.Material         = mlper.Material
                                                                        and mlprc.CurrencyRole     = mlper.CurrencyRole
                                                                        and mlprc.FiscalYearPeriod = mlper.MLPriceLatestFiscalYearPeriod
  association [0..1] to R_MatlLedgerValnCrcyRole as _MLCurrencyInfo on  _MLCurrencyInfo.LedgerValuationCurrencyRole = mlper.CurrencyRole
                                                                    and _MLCurrencyInfo.CompanyCode = mlper.CompanyCode

{
  key  mlper.CostEstimate,
  key  coalesce(_MLCurrencyInfo.Ledger, cast('  ' as fins_ledger))   as Ledger,
  key  mlper.CurrencyRole,
  key  mlper.FiscalYear,
  key  mlper.FiscalPeriod,
  key  PeriodType,
  key  FiscalPeriodType,
       mlper.Material,
       mlper.ValuationArea,
       mlprc.InventoryValuationType,
       SalesOrder,
       SalesOrderItem,
       Supplier,
       WBSElementInternalID,
       WBSElementExternalID,
       InvtryValnSpecialStockType,
       InventorySpecialStockValnType,
       IsSupplierStockValuation,
       CompanyCode,
       PriceDeterminationControl,
       MaterialPriceControl,
       MaterialPriceUnitQty,
       Currency,
       MovingAveragePrice,
       StandardPrice,
       @Semantics.amount.currencyCode: 'Currency'
       InventoryPrice,
       FuturePrice,
       FuturePriceValidityStartDate,
       PlannedPrice,
       FutrCostEstValuationVariant,
       FutureCostEstFiscalYear,
       FutureCostEstimateFiscalPeriod,
       FutureCostEstCostingVersion,
       //       FutrPlanProjSlsOrdValnStrategy,

       FixedPortionOfPlannedPrice,

       _MLCurrencyInfo.LedgerName                                    as LedgerName,
       _MLCurrencyInfo.CurrencyRoleName                              as CurrencyRoleName,
       _MLCurrencyInfo.LegalCurrencyRole                             as LegalCurrencyRole,
       _MLCurrencyInfo.LegalCurrencyRoleName                         as LegalCurrencyRoleName,
       _MLCurrencyInfo.AccountingValuationView                       as AccountingValuationView,
       _MLCurrencyInfo.AcctgValnVwSubviewCombinedName                as AcctgValnVwSubviewCombinedName,
       _MLCurrencyInfo.LedgerValnCrcyRoleIsUsedInLogs                as LedgerValnCrcyRoleIsUsedInLogs

}

where
  ( (
       mlper.MatlPrcMigratedUntilFsclYrPerd = '0000000'
    or mlper.MatlPrcMigratedUntilFsclYrPerd > mlper.MLPriceLatestFiscalYearPeriod
  ) or tf.MatlPriceDataMigrationStatus = 'X' )

union all

select from              P_MlPrice_By_Periodtype   as mlprice
  inner join R_MatlPriceDataMigrationStatus as tf on(
    tf.MatlPriceDataMigrationStatus                                                 = 'F'
  )
                                                  or(
                                                    tf.MatlPriceDataMigrationStatus = 'R'
                                                  )                                                                              
association [0..1] to R_MatlLedgerValnCrcyRole as _MLCurrencyInfo on  _MLCurrencyInfo.CurrencyRole = mlprice.CurrencyRole
                                                                  and _MLCurrencyInfo.Ledger       = mlprice.Ledger
                                                                  and _MLCurrencyInfo.CompanyCode  = mlprice.CompanyCode

{
  key  CostEstimate,
  key  Ledger,
  key  CurrencyRole,
  key  FiscalYear,
  key  FiscalPeriod,
  key  PeriodType,
  key  FiscalPeriodType,
       Material,
       ValuationArea,
       InventoryValuationType,
       SalesOrder,
       SalesOrderItem,
       Supplier,
       WBSElementInternalID,
       WBSElementExternalID,
       InvtryValnSpecialStockType,
       InventorySpecialStockValnType,
       IsSupplierStockValuation,
       CompanyCode,
       PriceDeterminationControl,
       MaterialPriceControl,
       MaterialPriceUnitQty,
       Currency,
       MovingAveragePrice,
       StandardPrice,
       InventoryPrice,
       FuturePrice,
       FuturePriceValidityStartDate,
       PlannedPrice,
       FutrCostEstValuationVariant,
       FutureCostEstFiscalYear,
       FutureCostEstimateFiscalPeriod,
       FutureCostEstCostingVersion,
       //FutrPlanProjSlsOrdValnStrategy,

       FixedPortionOfPlannedPrice,

       _MLCurrencyInfo.LedgerName                                    as LedgerName,
       _MLCurrencyInfo.CurrencyRoleName                              as CurrencyRoleName,
       _MLCurrencyInfo.LegalCurrencyRole                             as LegalCurrencyRole,
       _MLCurrencyInfo.LegalCurrencyRoleName                         as LegalCurrencyRoleName,
       _MLCurrencyInfo.AccountingValuationView                       as AccountingValuationView,
       _MLCurrencyInfo.AcctgValnVwSubviewCombinedName                as AcctgValnVwSubviewCombinedName,
       _MLCurrencyInfo.LedgerValnCrcyRoleIsUsedInLogs                as LedgerValnCrcyRoleIsUsedInLogs

}

where
  ( (
          price_sdm_yearper    <> '0000000'
      and price_sdm_yearper    <= MatlPrcValdtyStrtFsclYearPerd
    ) or tf.MatlPriceDataMigrationStatus = 'F'
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_MLPRICE_BY_PERIODTYPE",
"P_MLPRICE_PERIOD_BY_PERIODTYPE",
"R_MATERIALLEDGERPRICECMPTBLTY",
"R_MATLLEDGERVALNCRCYROLE",
"R_MATLPRICEDATAMIGRATIONSTATUS"
],
"ASSOCIATED":
[
"R_MATLLEDGERVALNCRCYROLE"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/