R_MatlLdgrPriceByTwoValuations

DDL: R_MATLLDGRPRICEBYTWOVALUATIONS Type: view_entity COMPOSITE Package: ODATA_ML_MNTRMATLPRICES

Price Comparison in Two Valuations

R_MatlLdgrPriceByTwoValuations is a Composite CDS View that provides data about "Price Comparison in Two Valuations" in SAP S/4HANA. It reads from 1 data source (I_MaterialLedgerPrice) and exposes 49 fields with key fields CostEstimate, MaterialPriceType, MaterialPriceSubtype, MaterialPriceValuation1StrtDt, MaterialPriceValuation1EndDate. It has 12 associations to related views. Part of development package ODATA_ML_MNTRMATLPRICES.

Data Sources (1)

SourceAliasJoin Type
I_MaterialLedgerPrice _Valuation1 from

Parameters (5)

NameTypeDefault
P_MaterialLedgerLedger1 fins_ledger
P_MaterialLedgerCurrencyRole1 fins_ext_curtype
P_MaterialLedgerLedger2 fins_ledger
P_MaterialLedgerCurrencyRole2 fins_ext_curtype
P_ValidOnDate fml_date_valid_on

Associations (12)

CardinalityTargetAliasCondition
[0..1] R_MatlValnEndgInvtryByKeyDate _TotalValuatedStockAmount1 $projection.CostEstimate = _TotalValuatedStockAmount1.CostEstimate and $projection.Material = _TotalValuatedStockAmount1.Material and $projection.ValuationArea = _TotalValuatedStockAmount1.ValuationArea and $projection.CompanyCode = _TotalValuatedStockAmount1.CompanyCode and _TotalValuatedStockAmount1.Ledger = $parameters.P_MaterialLedgerLedger1 and _TotalValuatedStockAmount1.CurrencyRole = $parameters.P_MaterialLedgerCurrencyRole1 and $projection.P_ValidOnDate = _TotalValuatedStockAmount1.ValidOnDate
[0..1] R_MatlValnEndgInvtryByKeyDate _TotalValuatedStockAmount2 $projection.CostEstimate = _TotalValuatedStockAmount2.CostEstimate and $projection.Material = _TotalValuatedStockAmount2.Material and $projection.ValuationArea = _TotalValuatedStockAmount2.ValuationArea and $projection.CompanyCode = _TotalValuatedStockAmount2.CompanyCode and _TotalValuatedStockAmount2.Ledger = $parameters.P_MaterialLedgerLedger2 and _TotalValuatedStockAmount2.CurrencyRole = $parameters.P_MaterialLedgerCurrencyRole2 and $projection.P_ValidOnDate = _TotalValuatedStockAmount2.ValidOnDate
[0..1] I_Plant _Plant $projection.ValuationArea = _Plant.Plant
[1..1] I_Product _Product $projection.Material = _Product.Product
[1..1] I_CompanyCode _CompanyCode $projection.CompanyCode = _CompanyCode.CompanyCode
[0..1] I_MaterialPriceControl _MaterialPriceControl $projection.MaterialPriceControl = _MaterialPriceControl.MaterialPriceControl
[1..1] I_MaterialLedgerPriceType _PriceType $projection.MaterialPriceType = _PriceType.MaterialPriceType
[0..1] I_WBSElementBasicData _WBSElementBasicData $projection.WBSElementInternalID = _WBSElementBasicData.WBSElementInternalID
[0..1] I_InvtryValnSpecialStockType _InvtryValnSpecialStockType $projection.InvtryValnSpecialStockType = _InvtryValnSpecialStockType.InvtryValnSpecialStockType
[0..1] I_MatlPriceCostEstimateStage _MatlPriceCostEstimateStage $projection.MaterialPriceCostEstimateStage = _MatlPriceCostEstimateStage.MaterialPriceCostEstimateStage
[0..1] I_StkMatlPriceValuationType _StkMatlPriceValuationType $projection.StkMaterialPriceValuationType = _StkMatlPriceValuationType.StkMaterialPriceValuationType
[0..1] I_SlsOrdProjValnStrategyStdVH _SlsOrdProjValnStrategy $projection.CurPlanProjSlsOrdValnStrategy = _SlsOrdProjValnStrategy.SlsOrdProjValnStrategy

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #MANDATORY view
AccessControl.personalData.blocking #NOT_REQUIRED view
EndUserText.label Price Comparison in Two Valuations view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
VDM.lifecycle.contract.type #SAP_INTERNAL_API view
VDM.viewType #COMPOSITE view

Fields (49)

KeyFieldSource TableSource FieldDescription
KEY CostEstimate I_MaterialLedgerPrice CostEstimate Cost EstimateNo
KEY MaterialPriceType I_MaterialLedgerPrice MaterialPriceType Price Type
KEY MaterialPriceSubtype I_MaterialLedgerPrice MaterialPriceSubtype
KEY MaterialPriceValuation1StrtDt I_MaterialLedgerPrice MaterialPriceValidityStartDate
KEY MaterialPriceValuation1EndDate I_MaterialLedgerPrice MaterialPriceValidityEndDate
MaterialPriceValuation2StrtDt _Valuation2 MaterialPriceValidityStartDate
MaterialPriceValuation2EndDate _Valuation2 MaterialPriceValidityEndDate
MaterialPriceControl I_MaterialLedgerPrice MaterialPriceControl Price Control
CurPlanProjSlsOrdValnStrategy I_MaterialLedgerPrice CurPlanProjSlsOrdValnStrategy
MaterialPriceCostEstimateStage I_MaterialLedgerPrice MaterialPriceCostEstimateStage
Material I_MaterialLedgerPrice Material Vehicle Model
ValuationArea I_MaterialLedgerPrice ValuationArea Valuation Area
InventoryValuationType I_MaterialLedgerPrice InventoryValuationType Valuation Type
CompanyCode I_MaterialLedgerPrice CompanyCode Receiver Company Code
InvtryValnSpecialStockType I_MaterialLedgerPrice InvtryValnSpecialStockType
SalesOrder I_MaterialLedgerPrice SalesOrder SD Document
SalesOrderItem I_MaterialLedgerPrice SalesOrderItem Sales Order Item
WBSElementInternalID
Supplier I_MaterialLedgerPrice Supplier Supplier
StkMaterialPriceValuationType I_MaterialLedgerPrice StkMaterialPriceValuationType
MaterialPriceExtRefCategory I_MaterialLedgerPrice MaterialPriceExtRefCategory
MaterialPriceExtReference I_MaterialLedgerPrice MaterialPriceExtReference
SlsOrdProjValnStrgyName _SlsOrdProjValnStrategy SlsOrdProjValnStrgyName
MatPriceUnitInFreeDefinedCrcy1
AdditionalQuantity1Unit I_MaterialLedgerPrice ValuationQuantityUnit
MatPriceUnitInFreeDefinedCrcy2
AdditionalQuantity2Unit _Valuation2 ValuationQuantityUnit
AmountInFreeDefinedCurrency1
AmountInFreeDefinedCurrency2
FreeDefinedCurrency1 I_MaterialLedgerPrice Currency Valuation Crcy
FreeDefinedCurrency2 _Valuation2 Currency Valuation Crcy
dec232endasMatlLdgrPrThresholdInPercent
MatlLdgrPriceDifferenceAmount
ValidOnDate
MaterialLedgerLedger1
MaterialLedgerCurrencyRole1
MaterialLedgerLedger2
MaterialLedgerCurrencyRole2
_CompanyCode _CompanyCode
_InvtryValnSpecialStockType _InvtryValnSpecialStockType
_Product _Product
_MaterialPriceControl _MaterialPriceControl
_MatlPriceCostEstimateStage _MatlPriceCostEstimateStage
_Plant _Plant
_PriceType _PriceType
_StkMatlPriceValuationType _StkMatlPriceValuationType
_WBSElementBasicData _WBSElementBasicData
_TotalValuatedStockAmount1 _TotalValuatedStockAmount1
_TotalValuatedStockAmount2 _TotalValuatedStockAmount2

Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.

-- Derived SQL interpretation of CDS view R_MatlLdgrPriceByTwoValuations.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- Parameters: P_MaterialLedgerLedger1 : fins_ledger, P_MaterialLedgerCurrencyRole1 : fins_ext_curtype, P_MaterialLedgerLedger2 : fins_ledger, P_MaterialLedgerCurrencyRole2 : fins_ext_curtype, P_ValidOnDate : fml_date_valid_on

CREATE VIEW R_MatlLdgrPriceByTwoValuations AS
SELECT
  _Valuation1.CostEstimate AS CostEstimate,
  _Valuation1.MaterialPriceType AS MaterialPriceType,
  _Valuation1.MaterialPriceSubtype AS MaterialPriceSubtype,
  _Valuation1.MaterialPriceValidityStartDate AS MaterialPriceValuation1StrtDt,
  _Valuation1.MaterialPriceValidityEndDate AS MaterialPriceValuation1EndDate,
  _Valuation2.MaterialPriceValidityStartDate AS MaterialPriceValuation2StrtDt,
  _Valuation2.MaterialPriceValidityEndDate AS MaterialPriceValuation2EndDate,
  _Valuation1.MaterialPriceControl AS MaterialPriceControl,
  _Valuation1.CurPlanProjSlsOrdValnStrategy AS CurPlanProjSlsOrdValnStrategy,
  _Valuation1.MaterialPriceCostEstimateStage AS MaterialPriceCostEstimateStage,
  _Valuation1.Material AS Material,
  _Valuation1.ValuationArea AS ValuationArea,
  _Valuation1.InventoryValuationType AS InventoryValuationType,
  _Valuation1.CompanyCode AS CompanyCode,
  _Valuation1.InvtryValnSpecialStockType AS InvtryValnSpecialStockType,
  _Valuation1.SalesOrder AS SalesOrder,
  _Valuation1.SalesOrderItem AS SalesOrderItem,
  cast(_Valuation1.WBSElementInternalID as ps_s4_pspnr) AS WBSElementInternalID,
  _Valuation1.Supplier AS Supplier,
  _Valuation1.StkMaterialPriceValuationType AS StkMaterialPriceValuationType,
  _Valuation1.MaterialPriceExtRefCategory AS MaterialPriceExtRefCategory,
  _Valuation1.MaterialPriceExtReference AS MaterialPriceExtReference,
  _SlsOrdProjValnStrategy.SlsOrdProjValnStrgyName AS SlsOrdProjValnStrgyName,
  cast(_Valuation1.MaterialPriceUnitQty as peinh) AS MatPriceUnitInFreeDefinedCrcy1,
  _Valuation1.ValuationQuantityUnit AS AdditionalQuantity1Unit,
  cast(_Valuation2.MaterialPriceUnitQty as peinh) AS MatPriceUnitInFreeDefinedCrcy2,
  _Valuation2.ValuationQuantityUnit AS AdditionalQuantity2Unit,
  cast(_Valuation1.MaterialPrice as fis_osl) AS AmountInFreeDefinedCurrency1,
  cast(_Valuation2.MaterialPrice as fis_vsl) AS AmountInFreeDefinedCurrency2,
  _Valuation1.Currency AS FreeDefinedCurrency1,
  _Valuation2.Currency AS FreeDefinedCurrency2,
  case _Valuation1.MaterialPrice when 0 then 0 else cast((division(cast((_Valuation2.MaterialPrice - _Valuation1.MaterialPrice) as abap.dec(23,2)), cast(_Valuation1.MaterialPrice as abap.dec(23,2)), 4) * 100) as abap.dec(23,2)) end as MatlLdgrPrThresholdInPercent AS dec232endasMatlLdgrPrThresholdInPercent,
  cast(_Valuation2.MaterialPrice - _Valuation1.MaterialPrice as fml_difference_price) AS MatlLdgrPriceDifferenceAmount,
  $parameters.P_ValidOnDate AS ValidOnDate,
  $parameters.P_MaterialLedgerLedger1 AS MaterialLedgerLedger1,
  $parameters.P_MaterialLedgerCurrencyRole1 AS MaterialLedgerCurrencyRole1,
  $parameters.P_MaterialLedgerLedger2 AS MaterialLedgerLedger2,
  $parameters.P_MaterialLedgerCurrencyRole2 AS MaterialLedgerCurrencyRole2
FROM I_MaterialLedgerPrice AS _Valuation1
LEFT OUTER JOIN R_MatlValnEndgInvtryByKeyDate AS _TotalValuatedStockAmount1 ON CostEstimate = _TotalValuatedStockAmount1.CostEstimate AND Material = _TotalValuatedStockAmount1.Material AND ValuationArea = _TotalValuatedStockAmount1.ValuationArea AND CompanyCode = _TotalValuatedStockAmount1.CompanyCode AND _TotalValuatedStockAmount1.Ledger = $parameters.P_MaterialLedgerLedger1 AND _TotalValuatedStockAmount1.CurrencyRole = $parameters.P_MaterialLedgerCurrencyRole1 AND P_ValidOnDate = _TotalValuatedStockAmount1.ValidOnDate  -- association [0..1]
LEFT OUTER JOIN R_MatlValnEndgInvtryByKeyDate AS _TotalValuatedStockAmount2 ON CostEstimate = _TotalValuatedStockAmount2.CostEstimate AND Material = _TotalValuatedStockAmount2.Material AND ValuationArea = _TotalValuatedStockAmount2.ValuationArea AND CompanyCode = _TotalValuatedStockAmount2.CompanyCode AND _TotalValuatedStockAmount2.Ledger = $parameters.P_MaterialLedgerLedger2 AND _TotalValuatedStockAmount2.CurrencyRole = $parameters.P_MaterialLedgerCurrencyRole2 AND P_ValidOnDate = _TotalValuatedStockAmount2.ValidOnDate  -- association [0..1]
LEFT OUTER JOIN I_Plant AS _Plant ON ValuationArea = _Plant.Plant  -- association [0..1]
LEFT OUTER JOIN I_Product AS _Product ON Material = _Product.Product  -- association [1..1]
LEFT OUTER JOIN I_CompanyCode AS _CompanyCode ON CompanyCode = _CompanyCode.CompanyCode  -- association [1..1]
LEFT OUTER JOIN I_MaterialPriceControl AS _MaterialPriceControl ON MaterialPriceControl = _MaterialPriceControl.MaterialPriceControl  -- association [0..1]
LEFT OUTER JOIN I_MaterialLedgerPriceType AS _PriceType ON MaterialPriceType = _PriceType.MaterialPriceType  -- association [1..1]
LEFT OUTER JOIN I_WBSElementBasicData AS _WBSElementBasicData ON WBSElementInternalID = _WBSElementBasicData.WBSElementInternalID  -- association [0..1]
LEFT OUTER JOIN I_InvtryValnSpecialStockType AS _InvtryValnSpecialStockType ON InvtryValnSpecialStockType = _InvtryValnSpecialStockType.InvtryValnSpecialStockType  -- association [0..1]
LEFT OUTER JOIN I_MatlPriceCostEstimateStage AS _MatlPriceCostEstimateStage ON MaterialPriceCostEstimateStage = _MatlPriceCostEstimateStage.MaterialPriceCostEstimateStage  -- association [0..1]
LEFT OUTER JOIN I_StkMatlPriceValuationType AS _StkMatlPriceValuationType ON StkMaterialPriceValuationType = _StkMatlPriceValuationType.StkMaterialPriceValuationType  -- association [0..1]
LEFT OUTER JOIN I_SlsOrdProjValnStrategyStdVH AS _SlsOrdProjValnStrategy ON CurPlanProjSlsOrdValnStrategy = _SlsOrdProjValnStrategy.SlsOrdProjValnStrategy  -- association [0..1]
;