P_PhysInvtryProposal_L2

DDL: P_PHYSINVTRYPROPOSAL_L2 Type: view_entity COMPOSITE Package: ODATA_MM_IM_PI_MASS_CREATE

Inventory proposal level 2

P_PhysInvtryProposal_L2 is a Composite CDS View that provides data about "Inventory proposal level 2" in SAP S/4HANA. It reads from 2 data sources (I_CompanyCode, P_PhysInvtryProposal_L1) and exposes 28 fields with key fields Material, Plant, StorageLocation, Batch, Supplier. It has 3 associations to related views. Part of development package ODATA_MM_IM_PI_MASS_CREATE.

Data Sources (2)

SourceAliasJoin Type
I_CompanyCode _CompanyCode inner
P_PhysInvtryProposal_L1 L1 from

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_WBSElementBasicData _WBSElement $projection.WBSElementInternalID = _WBSElement.WBSElementInternalID
[0..1] I_AdjmtPostingMovementType _AdjmtPostingMovementTypeS MatDoc.GoodsMovementType = _AdjmtPostingMovementTypeS.PhysInvtryIncreasingQtyMvtType and MatDoc.InventorySpecialStockType = _AdjmtPostingMovementTypeS.InventorySpecialStockType and _AdjmtPostingMovementTypeS.PhysicalInventoryStockType <> ''
[0..1] I_AdjmtPostingMovementType _AdjmtPostingMovementTypeD MatDoc.GoodsMovementType = _AdjmtPostingMovementTypeD.PhysInvtryDecreasingQtyMvtType and MatDoc.InventorySpecialStockType = _AdjmtPostingMovementTypeD.InventorySpecialStockType and _AdjmtPostingMovementTypeD.PhysicalInventoryStockType <> ''

Annotations (9)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
EndUserText.label Inventory proposal level 2 view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (28)

KeyFieldSource TableSource FieldDescription
KEY Material P_PhysInvtryProposal_L1 Material Vehicle Model
KEY Plant P_PhysInvtryProposal_L1 Plant Valuation Area
KEY StorageLocation P_PhysInvtryProposal_L1 StorageLocation StorageLocation
KEY Batch P_PhysInvtryProposal_L1 Batch Lot No.
Batch Lot No.
KEY Supplier P_PhysInvtryProposal_L1 Supplier Supplier
KEY SalesOrder P_PhysInvtryProposal_L1 SalesOrder SD Document
KEY SalesOrderItem
KEY WBSElement
KEY Customer P_PhysInvtryProposal_L1 Customer Sold-to Party
KEY StockOwner P_PhysInvtryProposal_L1 StockOwner Owner of stock
KEY InventoryStockType P_PhysInvtryProposal_L1 InventoryStockType Stock Type
KEY InventorySpecialStockType P_PhysInvtryProposal_L1 InventorySpecialStockType Special Stock Type
KEY MaterialBaseUnit P_PhysInvtryProposal_L1 MaterialBaseUnit Valuation Unit
KEY MaterialIsPostedToStock P_PhysInvtryProposal_L1 MaterialIsPostedToStock
CostEstimate P_PhysInvtryProposal_L1 CostEstimate Cost EstimateNo
InventoryValuationType P_PhysInvtryProposal_L1 InventoryValuationType Valuation Type
RealProductBatch P_PhysInvtryProposal_L1 RealProductBatch
RealProductBatch
CycleCountType P_PhysInvtryProposal_L1 CycleCountType Cycle Count Type
SerialIdentifierAssgmtProfile P_PhysInvtryProposal_L1 SerialIdentifierAssgmtProfile Serial No. Prf.
MatlBatchIsInRstrcdUseStock P_PhysInvtryProposal_L1 MatlBatchIsInRstrcdUseStock Batch restr.
WBSElementInternalID P_PhysInvtryProposal_L1 WBSElementInternalID WBS Internal ID
CompanyCodeCurrency I_CompanyCode Currency Valuation Crcy
CurrentDate P_PhysInvtryProposal_L1 CurrentDate
MatlWrhsStkQtyInMatlBaseUnit P_PhysInvtryProposal_L1 MatlWrhsStkQtyInMatlBaseUnit Quantity
PhysicalInventoryLastCountDate
fltpendasAvgStkQtySinceLastCountCorrect

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

CREATE VIEW P_PhysInvtryProposal_L2 AS
SELECT
  L1.Material AS Material,
  L1.Plant AS Plant,
  L1.StorageLocation AS StorageLocation,
  L1.Batch AS Batch,
  L1.Supplier AS Supplier,
  L1.SalesOrder AS SalesOrder,
  case when L1.SalesOrderItem is null then '000000' else L1.SalesOrderItem end AS SalesOrderItem,
  case when L1.WBSElementInternalID = '00000000' then '' else _WBSElement.WBSElement end AS WBSElement,
  L1.Customer AS Customer,
  L1.StockOwner AS StockOwner,
  L1.InventoryStockType AS InventoryStockType,
  L1.InventorySpecialStockType AS InventorySpecialStockType,
  L1.MaterialBaseUnit AS MaterialBaseUnit,
  L1.MaterialIsPostedToStock AS MaterialIsPostedToStock,
  L1.CostEstimate AS CostEstimate,
  L1.InventoryValuationType AS InventoryValuationType,
  L1.RealProductBatch AS RealProductBatch,
  L1.CycleCountType AS CycleCountType,
  L1.SerialIdentifierAssgmtProfile AS SerialIdentifierAssgmtProfile,
  L1.MatlBatchIsInRstrcdUseStock AS MatlBatchIsInRstrcdUseStock,
  L1.WBSElementInternalID AS WBSElementInternalID,
  _CompanyCode.Currency AS CompanyCodeCurrency,
  L1.CurrentDate AS CurrentDate,
  L1.MatlWrhsStkQtyInMatlBaseUnit AS MatlWrhsStkQtyInMatlBaseUnit,
  cast(L1.PhysicalInventoryLastCountDate as pi_last_count_date preserving type) AS PhysicalInventoryLastCountDate,
  sum( case when MatDoc.PostingDate > L1.CurrentDate then cast( MatDoc.MatlStkChangeQtyInBaseUnit as abap.fltp) when MatDoc.PostingDate is null or MatDoc.PostingDate < L1.PhysicalInventoryLastCountDate then cast( 0 as abap.fltp) when MatDoc.PostingDate = L1.PhysicalInventoryLastCountDate then cast(MatDoc.MatlStkChangeQtyInBaseUnit as abap.fltp) *0.5 / (1.0 + cast(dats_days_between( L1.PhysicalInventoryLastCountDate, L1.CurrentDate ) as abap.fltp)) else cast(MatDoc.MatlStkChangeQtyInBaseUnit as abap.fltp) * (0.5 + cast(dats_days_between( L1.PhysicalInventoryLastCountDate, MatDoc.PostingDate ) as abap.fltp)) / (1.0 + cast(dats_days_between( L1.PhysicalInventoryLastCountDate, L1.CurrentDate ) as abap.fltp)) end ) as AvgStkQtySinceLastCountCorrect AS fltpendasAvgStkQtySinceLastCountCorrect
FROM P_PhysInvtryProposal_L1 AS L1
INNER JOIN I_CompanyCode AS _CompanyCode ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_WBSElementBasicData AS _WBSElement ON WBSElementInternalID = _WBSElement.WBSElementInternalID  -- association [0..1]
LEFT OUTER JOIN I_AdjmtPostingMovementType AS _AdjmtPostingMovementTypeS ON MatDoc.GoodsMovementType = _AdjmtPostingMovementTypeS.PhysInvtryIncreasingQtyMvtType AND MatDoc.InventorySpecialStockType = _AdjmtPostingMovementTypeS.InventorySpecialStockType AND _AdjmtPostingMovementTypeS.PhysicalInventoryStockType <> ''  -- association [0..1]
LEFT OUTER JOIN I_AdjmtPostingMovementType AS _AdjmtPostingMovementTypeD ON MatDoc.GoodsMovementType = _AdjmtPostingMovementTypeD.PhysInvtryDecreasingQtyMvtType AND MatDoc.InventorySpecialStockType = _AdjmtPostingMovementTypeD.InventorySpecialStockType AND _AdjmtPostingMovementTypeD.PhysicalInventoryStockType <> ''  -- association [0..1]
;