P_InvPrice_Union_Old

DDL: P_INVPRICE_UNION_OLD SQL: PINVPRUNIOLD Type: view BASIC

P_InvPrice_Union_Old is a Basic CDS View in SAP S/4HANA. It reads from 1 data source (ckmlhd) and exposes 33 fields with key fields CostEstimate, Ledger, CurrencyRole. It has 2 associations to related views.

Data Sources (1)

SourceAliasJoin Type
ckmlhd hd from

Parameters (1)

NameTypeDefault
P_CalendarDate calendardate

Associations (2)

CardinalityTargetAliasCondition
[0..1] R_LedgerValuationCrcyRole _CurrencyInfo _CurrencyInfo.LedgerValuationCurrencyRole = cr.curtp
[0..1] I_MatlLedgerValnCrcyRoleName _MLCurrencyInfo _MLCurrencyInfo.LedgerValuationCurrencyRole = cr.curtp and _MLCurrencyInfo.CompanyCode = tk.bukrs

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PINVPRUNIOLD view
AbapCatalog.preserveKey true view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #BASIC view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (33)

KeyFieldSource TableSource FieldDescription
KEY CostEstimate ckmlhd kalnr
KEY Ledger
KEY CurrencyRole cr curtp
MaxFiscPerCKMLPP zp MaxFiscPerCKMLPP
FiscalPeriod cr poper
FiscalYear cr bdatj
Material ckmlhd matnr
ValuationArea ckmlhd bwkey
InventoryValuationType ckmlhd bwtar
SalesOrder ckmlhd vbeln
SalesOrderItem ckmlhd posnr
Supplier ckmlhd lifnr
WBSElementInternalID ckmlhd pspnr
CompanyCode tk bukrs
BaseUnit pp meins
InventorySpecialStockType ckmlhd sobkz
InventorySpecialStockValnType ckmlhd kzbws
IsSupplierStockValuation ckmlhd xobew
PriceDeterminationControl ckmlhd mlast
MatlPrcMigratedUntilFsclYrPerd ckmlhd price_sdm_yearper
MaterialPriceControl cr vprsv
MaterialPriceUnitQty
Currency cr waers
stprs0endasInventoryPrice
StandardPrice cr stprs
MovingAveragePrice cr pvprs
LedgerName _MLCurrencyInfo LedgerName
CurrencyRoleName _CurrencyInfo CurrencyRoleName
LegalCurrencyRole _CurrencyInfo LegalCurrencyRole
LegalCurrencyRoleName _CurrencyInfo LegalCurrencyRoleName
AccountingValuationView
AcctgValnVwSubviewCombinedName _CurrencyInfo AcctgValnVwSubviewCombinedName
LedgerValnCrcyRoleIsUsedInLogs _MLCurrencyInfo LedgerValnCrcyRoleIsUsedInLogs
@AbapCatalog.sqlViewName: 'PINVPRUNIOLD'
@AbapCatalog.preserveKey:true
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@VDM.viewType: #BASIC
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view P_InvPrice_Union_Old
  with parameters
    P_CalendarDate : calendardate

  as select from           ckmlhd                      as hd
    left outer to one join P_InvPrice_MaxFiscalYearPeriod(P_CalendarDate :
                           $parameters.P_CalendarDate) as zp on zp.CostEstimate = hd.kalnr
    left outer to one join ckmlcr                      as cr on  cr.kalnr = hd.kalnr
                                                             and cr.bdatj = left(
      zp.MaxFiscPerCKMLPP, 4
    )
                                                             and cr.poper = right(
      zp.MaxFiscPerCKMLPP, 3
    )
    left outer to one join ckmlpp                      as pp on  pp.kalnr = hd.kalnr
                                                             and pp.bdatj = left(
      zp.MaxFiscPerCKMLPP, 4
    )
                                                             and pp.poper = right(
      zp.MaxFiscPerCKMLPP, 3
    )

    left outer to one join t001k                       as tk on hd.bwkey = tk.bwkey
  association [0..1] to R_LedgerValuationCrcyRole as _CurrencyInfo on _CurrencyInfo.LedgerValuationCurrencyRole = cr.curtp
  association [0..1] to I_MatlLedgerValnCrcyRoleName as _MLCurrencyInfo on  _MLCurrencyInfo.LedgerValuationCurrencyRole = cr.curtp
                                                                        and _MLCurrencyInfo.CompanyCode = tk.bukrs

{

  key  hd.kalnr                                                    as CostEstimate,
  key  coalesce(_MLCurrencyInfo.Ledger, cast('  ' as fins_ledger)) as Ledger,
  key  cr.curtp                                                    as CurrencyRole,

       zp.MaxFiscPerCKMLPP                                         as MaxFiscPerCKMLPP,
       cr.poper                                                    as FiscalPeriod,
       cr.bdatj                                                    as FiscalYear,
       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,
       tk.bukrs                                                    as CompanyCode,
       pp.meins                                                    as BaseUnit,
       hd.sobkz                                                    as InventorySpecialStockType,
       hd.kzbws                                                    as InventorySpecialStockValnType,
       hd.xobew                                                    as IsSupplierStockValuation,
       hd.mlast                                                    as PriceDeterminationControl,
       hd.price_sdm_yearper                                        as MatlPrcMigratedUntilFsclYrPerd,
       cr.vprsv                                                    as MaterialPriceControl,
       coalesce(cr.peinh, 1)                                       as MaterialPriceUnitQty,
       cr.waers                                                    as Currency,
       @Semantics.amount.currencyCode: 'Currency'
       case cr.vprsv
         when 'S' then coalesce(cr.stprs, 0)
         when 'V' then coalesce(cr.pvprs, 0)
         else coalesce(cr.stprs, 0)
       end                                                         as InventoryPrice,
       @Semantics.amount.currencyCode: 'Currency'
       cr.stprs                                                    as StandardPrice,
       @Semantics.amount.currencyCode: 'Currency'
       cr.pvprs                                                    as MovingAveragePrice,

       _MLCurrencyInfo.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

}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MATLLEDGERVALNCRCYROLENAME",
"P_INVPRICE_MAXFISCALYEARPERIOD",
"R_LEDGERVALUATIONCRCYROLE",
"CKMLCR",
"CKMLHD",
"CKMLPP",
"T001K"
],
"ASSOCIATED":
[
"I_MATLLEDGERVALNCRCYROLENAME",
"R_LEDGERVALUATIONCRCYROLE"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/