P_MatVal_By_Period_Types

DDL: P_MATVAL_BY_PERIOD_TYPES SQL: PMTVLPERIODTYPES Type: view COMPOSITE Package: ODATA_MATVAL_MANAGE

Prices and values for app Mat. Val. Manage

P_MatVal_By_Period_Types is a Composite CDS View that provides data about "Prices and values for app Mat. Val. Manage" in SAP S/4HANA. It reads from 9 data sources and exposes 61 fields with key fields CostEstimate, FiscalYear, FiscalPeriod, LedgerValuationCurrencyRole, Ledger. Part of development package ODATA_MATVAL_MANAGE.

Data Sources (9)

Annotations (6)

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

Fields (61)

KeyFieldSource TableSource FieldDescription
KEY CostEstimate I_MaterialLedgerPrice CostEstimate
KEY FiscalYear P_CCLdgrShiftedPrevYearPer CurrentFiscalYear
KEY FiscalPeriod P_CCLdgrShiftedPrevYearPer CurrentFiscalPeriod
KEY LedgerValuationCurrencyRole R_MatlLedgerValnCrcyRole LedgerValuationCurrencyRole
KEY Ledger R_MatlLedgerValnCrcyRole Ledger
KEY ValuationArea I_MaterialLedgerPrice ValuationArea
FiscalYearPer P_CCLdgrShiftedPrevYearPer CurrentFiscalYearPeriod
CurrencyRole R_MatlLedgerValnCrcyRole CurrencyRole
CompanyCode I_MaterialLedgerPrice CompanyCode
Material I_MaterialLedgerPrice Material
MaterialPrice I_MaterialLedgerPrice MaterialPrice
Currency I_MaterialLedgerPrice Currency
MaterialPriceControl I_MaterialLedgerPrice MaterialPriceControl
MatlPrcValdtyStrtFsclYearPerd I_MaterialLedgerPrice MatlPrcValdtyStrtFsclYearPerd
MatlPrcValdtyEndFsclYearPeriod I_MaterialLedgerPrice MatlPrcValdtyEndFsclYearPeriod
MaterialPriceUnitQty I_MaterialLedgerPrice MaterialPriceUnitQty
BaseUnit I_MaterialLedgerPrice ValuationQuantityUnit
InventoryValuationType I_MaterialLedgerPrice InventoryValuationType
MaxFiscPerCKMLPP I_MaterialLedgerPrice MatlPrcValdtyStrtFsclYearPerd
period_type
CostEstimate
KEY FiscalYear P_CCLdgrShiftedPrevYearPer PreviousFiscalPeriodFiscalYear
KEY FiscalPeriod P_CCLdgrShiftedPrevYearPer PreviousFiscalPeriod
KEY LedgerValuationCurrencyRole R_MatlLedgerValnCrcyRole LedgerValuationCurrencyRole
KEY Ledger R_MatlLedgerValnCrcyRole Ledger
KEY ValuationArea I_MaterialLedgerPrice ValuationArea
FiscalYearPer P_CCLdgrShiftedPrevYearPer PreviousFiscalYearPeriod
CurrencyRole R_MatlLedgerValnCrcyRole CurrencyRole
CompanyCode I_MaterialLedgerPrice CompanyCode
Material I_MaterialLedgerPrice Material
MaterialPrice I_MaterialLedgerPrice MaterialPrice
Currency I_MaterialLedgerPrice Currency
MaterialPriceControl I_MaterialLedgerPrice MaterialPriceControl
MatlPrcValdtyStrtFsclYearPerd I_MaterialLedgerPrice MatlPrcValdtyStrtFsclYearPerd
MatlPrcValdtyEndFsclYearPeriod I_MaterialLedgerPrice MatlPrcValdtyEndFsclYearPeriod
MaterialPriceUnitQty I_MaterialLedgerPrice MaterialPriceUnitQty
BaseUnit I_MaterialLedgerPrice ValuationQuantityUnit
InventoryValuationType I_MaterialLedgerPrice InventoryValuationType
MaxFiscPerCKMLPP I_MaterialLedgerPrice MatlPrcValdtyStrtFsclYearPerd
period_type
CostEstimate
KEY FiscalYear P_CCLdgrShiftedPrevYearPer PreviousFiscalYear
KEY FiscalPeriod P_CCLdgrShiftedPrevYearPer PrevFiscalYearLastFiscalPeriod
KEY LedgerValuationCurrencyRole R_MatlLedgerValnCrcyRole LedgerValuationCurrencyRole
KEY Ledger R_MatlLedgerValnCrcyRole Ledger
KEY ValuationArea I_MaterialLedgerPrice ValuationArea
FiscalYearPer P_CCLdgrShiftedPrevYearPer PrevFsclYearLastFsclYearPeriod
CurrencyRole R_MatlLedgerValnCrcyRole CurrencyRole
CompanyCode I_MaterialLedgerPrice CompanyCode
Material I_MaterialLedgerPrice Material
MaterialPrice I_MaterialLedgerPrice MaterialPrice
Currency I_MaterialLedgerPrice Currency
MaterialPriceControl I_MaterialLedgerPrice MaterialPriceControl
MatlPrcValdtyStrtFsclYearPerd I_MaterialLedgerPrice MatlPrcValdtyStrtFsclYearPerd
MatlPrcValdtyEndFsclYearPeriod I_MaterialLedgerPrice MatlPrcValdtyEndFsclYearPeriod
MaterialPriceUnitQty I_MaterialLedgerPrice MaterialPriceUnitQty
BaseUnit I_MaterialLedgerPrice ValuationQuantityUnit
InventoryValuationType I_MaterialLedgerPrice InventoryValuationType
MaxFiscPerCKMLPP I_MaterialLedgerPrice MatlPrcValdtyStrtFsclYearPerd
period_type
JrnlEntrItemCrcyRolePosition R_MatlLedgerValnCrcyRole JrnlEntrItemCrcyRolePosition
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.sqlViewName: 'PMTVLPERIODTYPES'
@AbapCatalog.compiler.compareFilter:true
// Inventory prices - Period types definition 

// special logic: if VM and VJ are the same, only vm is selected

define view P_MatVal_By_Period_Types
  as
  // Current Period

  select from  I_MaterialLedgerPrice      as price
    inner join R_MatlLedgerValnCrcyRole   as mlnc on mlnc.CompanyCode  = price.CompanyCode
                                                 and mlnc.Ledger       = price.Ledger
                                                 and mlnc.CurrencyRole = price.CurrencyRole

    inner join P_MatlCtrlRecdLdgrFiscalPeriod as marvld on  marvld.CompanyCode = price.CompanyCode 
                                                        and marvld.Ledger      = price.Ledger
    

{
  key price.CostEstimate,
  key marvld.CurrentFiscalYear              as FiscalYear,
  key marvld.CurrentFiscalPeriod            as FiscalPeriod,
  key mlnc.LedgerValuationCurrencyRole      as LedgerValuationCurrencyRole,
  key mlnc.Ledger                           as Ledger,
  key price.ValuationArea,


      marvld.CurrentFiscalYearPeriod        as FiscalYearPer,
      mlnc.CurrencyRole                     as CurrencyRole,
      price.CompanyCode,
      price.Material,
       @Semantics.amount.currencyCode: 'Currency'
      price.MaterialPrice,
      price.Currency,
      price.MaterialPriceControl,
      price.MatlPrcValdtyStrtFsclYearPerd,
      price.MatlPrcValdtyEndFsclYearPeriod,
      price.MaterialPriceUnitQty,
      price.ValuationQuantityUnit           as BaseUnit,
      price.InventoryValuationType,

      price.MatlPrcValdtyStrtFsclYearPerd   as MaxFiscPerCKMLPP,
      'LF'                                  as period_type,
      mlnc.JrnlEntrItemCrcyRolePosition

}
where
      price.MaterialPriceType              = 'INVPR'
  and price.MaterialPriceSubtype           = ' '
  and price.MatlPrcValdtyEndFsclYearPeriod = '9999012'

// Previous period

union all select from I_MaterialLedgerPrice       as price
  inner join R_MatlLedgerValnCrcyRole   as mlnc on mlnc.CompanyCode  = price.CompanyCode
                                               and mlnc.Ledger       = price.Ledger
                                               and mlnc.CurrencyRole = price.CurrencyRole

  inner join P_MatlCtrlRecdLdgrFiscalPeriod as marvld on  marvld.CompanyCode = price.CompanyCode 
                                                      and marvld.Ledger      = price.Ledger

{
  key price.CostEstimate,
  key marvld.PreviousFiscalPeriodFiscalYear as FiscalYear,
  key marvld.PreviousFiscalPeriod           as FiscalPeriod,
  key mlnc.LedgerValuationCurrencyRole      as LedgerValuationCurrencyRole,
  key mlnc.Ledger                           as Ledger,
  key price.ValuationArea,

      marvld.PreviousFiscalYearPeriod       as FiscalYearPer,
      mlnc.CurrencyRole                     as CurrencyRole,
      price.CompanyCode,
      price.Material,
       @Semantics.amount.currencyCode: 'Currency'
      price.MaterialPrice,
      price.Currency,
      price.MaterialPriceControl,
      price.MatlPrcValdtyStrtFsclYearPerd,
      price.MatlPrcValdtyEndFsclYearPeriod,
      price.MaterialPriceUnitQty,
      price.ValuationQuantityUnit           as BaseUnit,
      price.InventoryValuationType,

      price.MatlPrcValdtyStrtFsclYearPerd   as MaxFiscPerCKMLPP,
      'VM'                                  as period_type,
      mlnc.JrnlEntrItemCrcyRolePosition

}
where
      price.MaterialPriceType              =                                                  'INVPR'
  and price.MaterialPriceSubtype           =                                                  ' '
  and price.MatlPrcValdtyStrtFsclYearPerd  <= marvld.PreviousFiscalYearPeriod
  and price.MatlPrcValdtyEndFsclYearPeriod >= marvld.PreviousFiscalYearPeriod

// Last period of previous fiscal year

union all select from I_MaterialLedgerPrice       as price
  inner join R_MatlLedgerValnCrcyRole   as mlnc on mlnc.CompanyCode  = price.CompanyCode
                                               and mlnc.Ledger       = price.Ledger
                                               and mlnc.CurrencyRole = price.CurrencyRole

  inner join P_CCLdgrShiftedPrevYearPer as marvld on  marvld.CompanyCode = price.CompanyCode 
                                                  and marvld.Ledger      = price.Ledger

{
  key price.CostEstimate,
  key marvld.PreviousFiscalYear             as FiscalYear,
  key marvld.PrevFiscalYearLastFiscalPeriod as FiscalPeriod,
  key mlnc.LedgerValuationCurrencyRole      as LedgerValuationCurrencyRole,
  key mlnc.Ledger                           as Ledger,
  key price.ValuationArea,

      marvld.PrevFsclYearLastFsclYearPeriod as FiscalYearPer,
      mlnc.CurrencyRole                     as CurrencyRole,
      price.CompanyCode,
      price.Material,
       @Semantics.amount.currencyCode: 'Currency'
      price.MaterialPrice,
      price.Currency,
      price.MaterialPriceControl,
      price.MatlPrcValdtyStrtFsclYearPerd,
      price.MatlPrcValdtyEndFsclYearPeriod,
      price.MaterialPriceUnitQty,
      price.ValuationQuantityUnit           as BaseUnit,
      price.InventoryValuationType,

      price.MatlPrcValdtyStrtFsclYearPerd   as MaxFiscPerCKMLPP,
      'VJ'                                  as period_type,
      mlnc.JrnlEntrItemCrcyRolePosition

}
where
        price.MaterialPriceType              =                                                    'INVPR'
  and   price.MaterialPriceSubtype           =                                                    ' '
  and   price.MatlPrcValdtyStrtFsclYearPerd  <= marvld.PrevFsclYearLastFsclYearPeriod
  and   price.MatlPrcValdtyEndFsclYearPeriod >= marvld.PrevFsclYearLastFsclYearPeriod

  // special logic: if VM and VJ are the same, only vm is selected

  and   not(
      marvld.PreviousFiscalPeriodFiscalYear   = marvld.PreviousFiscalYear 
      and marvld.PreviousFiscalPeriod         = marvld.PrevFiscalYearLastFiscalPeriod
    )