P_InventoryPriceByKeydate

DDL: P_INVENTORYPRICEBYKEYDATE SQL: PINVPRKEYDATE Type: view COMPOSITE Package: FINS_ML_VDM

Inventory Price by kaydate

P_InventoryPriceByKeydate is a Composite CDS View that provides data about "Inventory Price by kaydate" in SAP S/4HANA. It reads from 2 data sources (ckmlhd, I_MaterialLedgerPrice) and exposes 31 fields with key fields CostEstimate, CurrencyRole. It has 4 associations to related views. Part of development package FINS_ML_VDM.

Data Sources (2)

SourceAliasJoin Type
ckmlhd hd inner
I_MaterialLedgerPrice invprice from

Parameters (1)

NameTypeDefault
P_CalendarDate calendardate

Associations (4)

CardinalityTargetAliasCondition
[0..1] I_MaterialLedgerPrice _StandardPrice _StandardPrice.CostEstimate = invprice.CostEstimate and _StandardPrice.Ledger = invprice.Ledger and _StandardPrice.CurrencyRole = invprice.CurrencyRole and _StandardPrice.MaterialPriceType = 'STDPR' and _StandardPrice.MaterialPriceSubtype = ' ' and _StandardPrice.MaterialPriceValidityStartDate <= $parameters.P_CalendarDate and _StandardPrice.MaterialPriceValidityEndDate >= $parameters.P_CalendarDate
[0..1] I_MaterialLedgerPrice _ActualPrice _ActualPrice.CostEstimate = invprice.CostEstimate and _ActualPrice.Ledger = invprice.Ledger and _ActualPrice.CurrencyRole = invprice.CurrencyRole and _ActualPrice.MaterialPriceType = 'ACT' and _ActualPrice.MaterialPriceSubtype = 'ACT' and _ActualPrice.MaterialPriceValidityStartDate <= $parameters.P_CalendarDate and _ActualPrice.MaterialPriceValidityEndDate >= $parameters.P_CalendarDate
[0..1] R_LedgerValuationCrcyRole _CurrencyInfo _CurrencyInfo.CurrencyRole = invprice.CurrencyRole and _CurrencyInfo.Ledger = invprice.Ledger
[0..1] I_MatlLedgerValnCrcyRoleName _MLCurrencyInfo _MLCurrencyInfo.CompanyCode = invprice.CompanyCode and _MLCurrencyInfo.CurrencyRole = invprice.CurrencyRole and _MLCurrencyInfo.Ledger = invprice.Ledger

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PINVPRKEYDATE view
VDM.private true view
VDM.viewType #COMPOSITE view
VDM.lifecycle.status #DEPRECATED view
VDM.lifecycle.successor R_InventoryPriceByKeyDate view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (31)

KeyFieldSource TableSource FieldDescription
KEY CostEstimate I_MaterialLedgerPrice CostEstimate
KEY CurrencyRole I_MaterialLedgerPrice CurrencyRole
Ledger I_MaterialLedgerPrice Ledger
FiscalPeriod dp FiscalPeriod
FiscalYear
FiscalYearPeriod dp FiscalYearPeriod
Material ckmlhd matnr
ValuationArea ckmlhd bwkey
InventoryValuationType ckmlhd bwtar
SalesOrder ckmlhd vbeln
SalesOrderItem ckmlhd posnr
Supplier ckmlhd lifnr
WBSElementInternalID ckmlhd pspnr
CompanyCode I_MaterialLedgerPrice CompanyCode
BaseUnit I_MaterialLedgerPrice ValuationQuantityUnit
InventorySpecialStockType ckmlhd sobkz
InventorySpecialStockValnType ckmlhd kzbws
IsSupplierStockValuation ckmlhd xobew
PriceDeterminationControl ckmlhd mlast
MaterialPriceControl I_MaterialLedgerPrice MaterialPriceControl
MaterialPriceUnitQty I_MaterialLedgerPrice MaterialPriceUnitQty
Currency I_MaterialLedgerPrice Currency
InventoryPrice
ActualPrice
LedgerName _CurrencyInfo LedgerName
CurrencyRoleName _CurrencyInfo CurrencyRoleName
LegalCurrencyRole _CurrencyInfo LegalCurrencyRole
LegalCurrencyRoleName _CurrencyInfo LegalCurrencyRoleName
AccountingValuationView
AcctgValnVwSubviewCombinedName _CurrencyInfo AcctgValnVwSubviewCombinedName
LedgerValnCrcyRoleIsUsedInLogs _MLCurrencyInfo LedgerValnCrcyRoleIsUsedInLogs
@AbapCatalog.sqlViewName: 'PINVPRKEYDATE'
@VDM.private: true
@VDM.viewType: #COMPOSITE
@VDM.lifecycle.status: #DEPRECATED
@VDM.lifecycle.successor: 'R_InventoryPriceByKeyDate'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view P_InventoryPriceByKeydate
  with parameters
    P_CalendarDate : calendardate

  as select from  I_MaterialLedgerPrice          as invprice
  inner join ckmlhd                              as hd on hd.kalnr = invprice.CostEstimate
  left outer to one join t001                    as t1 on t1.bukrs = invprice.CompanyCode
  left outer to one join I_Distinct_Postingdate  as dp on  dp.FiscalYearVariant = t1.periv
                                                       and dp.CalendarDate      = $parameters.P_CalendarDate
                                                       and dp.IsSpecialPeriod   <> 'X'  
association [0..1] to I_MaterialLedgerPrice      as _StandardPrice  on  _StandardPrice.CostEstimate                   = invprice.CostEstimate
                                                                   and _StandardPrice.Ledger                         = invprice.Ledger
                                                                   and _StandardPrice.CurrencyRole                   = invprice.CurrencyRole
                                                                   and _StandardPrice.MaterialPriceType              = 'STDPR'
                                                                   and _StandardPrice.MaterialPriceSubtype           = ' '
                                                                   and _StandardPrice.MaterialPriceValidityStartDate <= $parameters.P_CalendarDate
                                                                   and _StandardPrice.MaterialPriceValidityEndDate   >= $parameters.P_CalendarDate
association [0..1] to I_MaterialLedgerPrice       as _ActualPrice    on  _ActualPrice.CostEstimate                   = invprice.CostEstimate
                                                                     and _ActualPrice.Ledger                         = invprice.Ledger
                                                                     and _ActualPrice.CurrencyRole                   = invprice.CurrencyRole
                                                                     and _ActualPrice.MaterialPriceType              = 'ACT'
                                                                     and _ActualPrice.MaterialPriceSubtype           = 'ACT'
                                                                     and _ActualPrice.MaterialPriceValidityStartDate <= $parameters.P_CalendarDate
                                                                      and _ActualPrice.MaterialPriceValidityEndDate   >= $parameters.P_CalendarDate                                                                      
association [0..1] to R_LedgerValuationCrcyRole    as _CurrencyInfo   on  _CurrencyInfo.CurrencyRole = invprice.CurrencyRole
                                                                      and _CurrencyInfo.Ledger       = invprice.Ledger
association [0..1] to I_MatlLedgerValnCrcyRoleName as _MLCurrencyInfo on  _MLCurrencyInfo.CompanyCode  = invprice.CompanyCode
                                                                      and _MLCurrencyInfo.CurrencyRole = invprice.CurrencyRole
                                                                      and _MLCurrencyInfo.Ledger       = invprice.Ledger

{
  key invprice.CostEstimate,
  key invprice.CurrencyRole,
      invprice.Ledger,

      dp.FiscalPeriod                                             as FiscalPeriod,
      cast( dp.FiscalYear as fins_gjahr )                         as FiscalYear,   
      dp.FiscalYearPeriod                                         as FiscalYearPeriod,   
      hd.matnr                                                    as Material,
      hd.bwkey                                                    as ValuationArea,
      hd.bwtar                                                    as InventoryValuationType,
      hd.vbeln                                                    as SalesOrder,
      hd.posnr                                                    as SalesOrderItem,
      hd.lifnr                                                    as Supplier,
      hd.pspnr                                                    as WBSElementInternalID,
      invprice.CompanyCode                                        as CompanyCode,
      invprice.ValuationQuantityUnit                              as BaseUnit,
      hd.sobkz                                                    as InventorySpecialStockType,
      hd.kzbws                                                    as InventorySpecialStockValnType,
      hd.xobew                                                    as IsSupplierStockValuation,
      hd.mlast                                                    as PriceDeterminationControl,

      invprice.MaterialPriceControl,
      invprice.MaterialPriceUnitQty,
      invprice.Currency,
      @Semantics.amount.currencyCode: 'Currency'
      cast( invprice.MaterialPrice as fml_inventory_price )       as InventoryPrice,
      @Semantics.amount.currencyCode: 'Currency'
      case invprice.MaterialPriceControl
          when 'S' then cast( coalesce(invprice.MaterialPrice, 0) as ck_stprs_1 )
          else cast( coalesce(_StandardPrice.MaterialPrice, 0) as ck_stprs_1 )
      end                                                         as StandardPrice,
      @Semantics.amount.currencyCode: 'Currency' 
      cast( _ActualPrice.MaterialPrice as fml_actual_price )      as ActualPrice,
      _CurrencyInfo.LedgerName                                    as LedgerName,
      _CurrencyInfo.CurrencyRoleName                              as CurrencyRoleName,
      _CurrencyInfo.LegalCurrencyRole                             as LegalCurrencyRole,
      _CurrencyInfo.LegalCurrencyRoleName                         as LegalCurrencyRoleName,
      cast(_CurrencyInfo.AccountingValuationView as fins_valutyp) as AccountingValuationView,
      _CurrencyInfo.AcctgValnVwSubviewCombinedName                as AcctgValnVwSubviewCombinedName,
      _MLCurrencyInfo.LedgerValnCrcyRoleIsUsedInLogs              as LedgerValnCrcyRoleIsUsedInLogs

}
where
          invprice.MaterialPriceType              =  'INVPR'
    and   invprice.MaterialPriceSubtype           =  ' '
    and   invprice.MaterialPriceValidityStartDate <= $parameters.P_CalendarDate
    and   invprice.MaterialPriceValidityEndDate   >= $parameters.P_CalendarDate