P_MaterialValuation

DDL: P_MATERIALVALUATION SQL: PMATLVALN Type: view COMPOSITE

P_MaterialValuation is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (P_Matval_Manage_Md2, I_MaterialLedgerPrice) and exposes 57 fields with key fields CostEstimate, CurrencyRole, Ledger, CurrencyRole, Ledger. It has 6 associations to related views.

Data Sources (2)

SourceAliasJoin Type
P_Matval_Manage_Md2 md union_all
I_MaterialLedgerPrice price from

Associations (6)

CardinalityTargetAliasCondition
[0..1] I_MaterialLedgerPrice _STDPR _STDPR.CostEstimate = price.CostEstimate and _STDPR.Ledger = price.Ledger and _STDPR.CurrencyRole = price.CurrencyRole and _STDPR.MaterialPriceType = 'STDPR' and _STDPR.MaterialPriceSubtype = '' and _STDPR.MatlPrcValdtyEndFsclYearPeriod = '9999012'
[0..1] I_MaterialLedgerPrice _ACT _ACT.CostEstimate = price.CostEstimate and _ACT.CurrencyRole = price.CurrencyRole and _ACT.Ledger = price.Ledger and _ACT.MaterialPriceType = 'ACT' and _ACT.MaterialPriceSubtype = 'ACT' and _ACT.MatlPrcValdtyEndFsclYearPeriod = '9999012'
[0..1] I_MaterialLedgerPrice _MAP _MAP.CostEstimate = price.CostEstimate and _MAP.CurrencyRole = price.CurrencyRole and _MAP.Ledger = price.Ledger and _MAP.MaterialPriceType = 'MAP' and _MAP.MaterialPriceSubtype = '' and _MAP.MatlPrcValdtyEndFsclYearPeriod = '9999012'
[0..1] I_WBSElementBasicData ps ps.WBSElementInternalID = xbew.WBSElement
[0..1] I_MaterialLedgerPrice _INVPR _INVPR.CostEstimate = md.CostEstimate and _INVPR.Ledger = md.Ledger and _INVPR.CurrencyRole = md.CurrencyRole and _INVPR.MaterialPriceType = 'INVPR' and _INVPR.MaterialPriceSubtype = '' and _INVPR.MatlPrcValdtyEndFsclYearPeriod = '9999012'
[0..1] I_MaterialLedgerPrice _FUTURE _FUTURE.CostEstimate = md.CostEstimate and _FUTURE.Ledger = md.Ledger and _FUTURE.CurrencyRole = md.CurrencyRole and _FUTURE.MaterialPriceType = 'FUTURE' and _FUTURE.MaterialPriceSubtype = '' and _FUTURE.MatlPrcValdtyEndFsclYearPeriod = '9999012'

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PMATLVALN 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 (57)

KeyFieldSource TableSource FieldDescription
KEY CostEstimate I_MaterialLedgerPrice CostEstimate Cost EstimateNo
KEY CurrencyRole I_MaterialLedgerPrice CurrencyRole Curr./Val. Type
KEY Ledger I_MaterialLedgerPrice Ledger Ledger
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
InventoryValuationCategory xbew InventoryValuationCategory
MaterialValuationClass xbew MaterialValuationClass Valuation Class
SalesOrder xbew SDDocument SD Document
SalesOrderItem xbew SDDocumentItem Sales Order Item
Supplier xbew Supplier Supplier
WBSElementInternalID ps WBSElementInternalID WBS Internal ID
InventorySpecialStockType xbew InventorySpecialStockType
PriceDeterminationControl xbew PriceDeterminationControl Price Determ.
BaseUnit I_MaterialLedgerPrice ValuationQuantityUnit
MaterialPriceUnitQty I_MaterialLedgerPrice MaterialPriceUnitQty Price unit
Currency I_MaterialLedgerPrice Currency Valuation Crcy
MaterialPriceControl I_MaterialLedgerPrice MaterialPriceControl Price Control
InventoryPrice I_MaterialLedgerPrice MaterialPrice Inventory Price
MaterialPriceendasMovingAveragePrice
MaterialPrice0endasStandardPrice
CurPlanProjSlsOrdValnStrategy I_MaterialLedgerPrice CurPlanProjSlsOrdValnStrategy
AmountInCompanyCodeCurrency
TotalVltdStockQuantity
LedgerValnCrcyRoleIsUsedInLogs crcy LedgerValnCrcyRoleIsUsedInLogs Is Log. Curr. Type
AccountingValuationView
LedgerName crcy LedgerName Ledger Name
CostEstimate Cost EstimateNo
KEY CurrencyRole P_Matval_Manage_Md2 CurrencyRole Curr./Val. Type
KEY Ledger P_Matval_Manage_Md2 Ledger Ledger
Material P_Matval_Manage_Md2 Material Vehicle Model
ValuationArea P_Matval_Manage_Md2 ValuationArea Valuation Area
InventoryValuationType Valuation Type
CompanyCode P_Matval_Manage_Md2 CompanyCode Receiver Company Code
InventoryValuationCategory P_Matval_Manage_Md2 InventoryValuationCategory
MaterialValuationClass P_Matval_Manage_Md2 MaterialValuationClass Valuation Class
SalesOrder P_Matval_Manage_Md2 SalesOrder SD Document
SalesOrderItem P_Matval_Manage_Md2 SalesOrderItem Sales Order Item
Supplier P_Matval_Manage_Md2 Supplier Supplier
WBSElementInternalID ps WBSElementInternalID WBS Internal ID
InventorySpecialStockType P_Matval_Manage_Md2 InvtryValnSpecialStockType
PriceDeterminationControl P_Matval_Manage_Md2 PriceDeterminationControl Price Determ.
BaseUnit P_Matval_Manage_Md2 ValuationQuantityUnit
MaterialPriceUnitQty Price unit
Currency P_Matval_Manage_Md2 Currency Valuation Crcy
MaterialPriceControl Price Control
InventoryPrice Inventory Price
MovingAveragePrice
StandardPrice
CurPlanProjSlsOrdValnStrategy _INVPR CurPlanProjSlsOrdValnStrategy
AmountInCompanyCodeCurrency
TotalVltdStockQuantity
LedgerValnCrcyRoleIsUsedInLogs crcy LedgerValnCrcyRoleIsUsedInLogs Is Log. Curr. Type
AccountingValuationView
LedgerName crcy LedgerName Ledger Name
CurrencyRoleName crcy CurrencyRoleName

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 P_MaterialValuation.
-- 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.
-- SQL view name: PMATLVALN

CREATE VIEW P_MaterialValuation AS
SELECT
  price.CostEstimate AS CostEstimate,
  price.CurrencyRole AS CurrencyRole,
  price.Ledger AS Ledger,
  price.Material AS Material,
  price.ValuationArea AS ValuationArea,
  price.InventoryValuationType AS InventoryValuationType,
  price.CompanyCode AS CompanyCode,
  xbew.InventoryValuationCategory AS InventoryValuationCategory,
  xbew.MaterialValuationClass AS MaterialValuationClass,
  xbew.SDDocument AS SalesOrder,
  xbew.SDDocumentItem AS SalesOrderItem,
  xbew.Supplier AS Supplier,
  ps.WBSElementInternalID AS WBSElementInternalID,
  xbew.InventorySpecialStockType AS InventorySpecialStockType,
  xbew.PriceDeterminationControl AS PriceDeterminationControl,
  price.ValuationQuantityUnit AS BaseUnit,
  price.MaterialPriceUnitQty AS MaterialPriceUnitQty,
  price.Currency AS Currency,
  price.MaterialPriceControl AS MaterialPriceControl,
  price.MaterialPrice AS InventoryPrice,
  case price.MaterialPriceControl when 'S' then case xbew.PriceDeterminationControl when '2' then coalesce(_MAP.MaterialPrice,0) when '3' then coalesce(_ACT.MaterialPrice,0) else cast (0 as fml_price ) end else price.MaterialPrice end as MovingAveragePrice AS MaterialPriceendasMovingAveragePrice,
  case price.MaterialPriceControl when 'S' then price.MaterialPrice else coalesce(_STDPR.MaterialPrice,0) end as StandardPrice AS MaterialPrice0endasStandardPrice,
  price.CurPlanProjSlsOrdValnStrategy AS CurPlanProjSlsOrdValnStrategy,
  cast ( coalesce(bal.AmountInCompanyCodeCurrency, 0) as fins_vhcur12) AS AmountInCompanyCodeCurrency,
  cast ( coalesce(bal.TotalVltdStockQuantity, 0) as fin_qtyval) AS TotalVltdStockQuantity,
  crcy.LedgerValnCrcyRoleIsUsedInLogs AS LedgerValnCrcyRoleIsUsedInLogs,
  cast(crcy.AccountingValuationView as fins_valutyp) AS AccountingValuationView,
  crcy.LedgerName AS LedgerName,
  coalesce(_INVPR.MaterialPrice,0) AS MovingAveragePrice,
  coalesce(_STDPR.MaterialPrice,0) AS StandardPrice,
  crcy.CurrencyRoleName AS CurrencyRoleName
FROM I_MaterialLedgerPrice AS price
LEFT OUTER JOIN I_MaterialLedgerPrice AS _STDPR ON _STDPR.CostEstimate = price.CostEstimate AND _STDPR.Ledger = price.Ledger AND _STDPR.CurrencyRole = price.CurrencyRole AND _STDPR.MaterialPriceType = 'STDPR' AND _STDPR.MaterialPriceSubtype = '' AND _STDPR.MatlPrcValdtyEndFsclYearPeriod = '9999012'  -- association [0..1]
LEFT OUTER JOIN I_MaterialLedgerPrice AS _ACT ON _ACT.CostEstimate = price.CostEstimate AND _ACT.CurrencyRole = price.CurrencyRole AND _ACT.Ledger = price.Ledger AND _ACT.MaterialPriceType = 'ACT' AND _ACT.MaterialPriceSubtype = 'ACT' AND _ACT.MatlPrcValdtyEndFsclYearPeriod = '9999012'  -- association [0..1]
LEFT OUTER JOIN I_MaterialLedgerPrice AS _MAP ON _MAP.CostEstimate = price.CostEstimate AND _MAP.CurrencyRole = price.CurrencyRole AND _MAP.Ledger = price.Ledger AND _MAP.MaterialPriceType = 'MAP' AND _MAP.MaterialPriceSubtype = '' AND _MAP.MatlPrcValdtyEndFsclYearPeriod = '9999012'  -- association [0..1]
LEFT OUTER JOIN I_WBSElementBasicData AS ps ON ps.WBSElementInternalID = xbew.WBSElement  -- association [0..1]
LEFT OUTER JOIN I_MaterialLedgerPrice AS _INVPR ON _INVPR.CostEstimate = md.CostEstimate AND _INVPR.Ledger = md.Ledger AND _INVPR.CurrencyRole = md.CurrencyRole AND _INVPR.MaterialPriceType = 'INVPR' AND _INVPR.MaterialPriceSubtype = '' AND _INVPR.MatlPrcValdtyEndFsclYearPeriod = '9999012'  -- association [0..1]
LEFT OUTER JOIN I_MaterialLedgerPrice AS _FUTURE ON _FUTURE.CostEstimate = md.CostEstimate AND _FUTURE.Ledger = md.Ledger AND _FUTURE.CurrencyRole = md.CurrencyRole AND _FUTURE.MaterialPriceType = 'FUTURE' AND _FUTURE.MaterialPriceSubtype = '' AND _FUTURE.MatlPrcValdtyEndFsclYearPeriod = '9999012'  -- association [0..1]
-- UNION ALL with additional select branch(es): P_Matval_Manage_Md2
;