P_EnhPhysInvtryActvStkSepSitn

DDL: P_ENHPHYSINVTRYACTVSTKSEPSITN Type: view_entity COMPOSITE Package: ODATA_MM_IM_PI_OBJECT_PAGE

Additional fields for P_PhysInvtryActvStkSeparatSitn

P_EnhPhysInvtryActvStkSepSitn is a Composite CDS View that provides data about "Additional fields for P_PhysInvtryActvStkSeparatSitn" in SAP S/4HANA. It reads from 3 data sources (I_CompanyCode, P_MatDocRec, P_PhysInvtryActvStkSeparatSitn) and exposes 20 fields with key fields Material, Plant, StorageLocation, Batch, Supplier. It has 3 associations to related views. Part of development package ODATA_MM_IM_PI_OBJECT_PAGE.

Data Sources (3)

SourceAliasJoin Type
I_CompanyCode _CompanyCode inner
P_MatDocRec MatDoc left_outer
P_PhysInvtryActvStkSeparatSitn sep 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 (3)

NameValueLevelField
AccessControl.authorizationCheck #NOT_ALLOWED view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (20)

KeyFieldSource TableSource FieldDescription
KEY Material P_PhysInvtryActvStkSeparatSitn Material Vehicle Model
KEY Plant P_PhysInvtryActvStkSeparatSitn Plant Valuation Area
KEY StorageLocation P_PhysInvtryActvStkSeparatSitn StorageLocation StorageLocation
KEY Batch P_PhysInvtryActvStkSeparatSitn Batch Lot No.
KEY Supplier P_PhysInvtryActvStkSeparatSitn Supplier Supplier
KEY SalesOrder P_PhysInvtryActvStkSeparatSitn SalesOrder SD Document
KEY SalesOrderItem P_PhysInvtryActvStkSeparatSitn SalesOrderItem Sales Order Item
KEY WBSElement
KEY Customer P_PhysInvtryActvStkSeparatSitn Customer Sold-to Party
KEY StockOwner P_PhysInvtryActvStkSeparatSitn StockOwner Owner of stock
KEY InventoryStockType P_PhysInvtryActvStkSeparatSitn InventoryStockType Stock Type
KEY InventorySpecialStockType P_PhysInvtryActvStkSeparatSitn InventorySpecialStockType Special Stock Type
KEY MaterialBaseUnit P_PhysInvtryActvStkSeparatSitn MaterialBaseUnit Valuation Unit
WBSElementInternalID P_PhysInvtryActvStkSeparatSitn WBSElementInternalID WBS Internal ID
CompanyCodeCurrency I_CompanyCode Currency Valuation Crcy
ProductType P_PhysInvtryActvStkSeparatSitn ProductType Product Type Group
ProductGroup P_PhysInvtryActvStkSeparatSitn ProductGroup Product Sold Group
MatlWrhsStkQtyInMatlBaseUnit P_PhysInvtryActvStkSeparatSitn MatlWrhsStkQtyInMatlBaseUnit Quantity
CurrentDate P_PhysInvtryActvStkSeparatSitn CurrentDate
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_EnhPhysInvtryActvStkSepSitn.
-- 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_EnhPhysInvtryActvStkSepSitn AS
SELECT
  sep.Material AS Material,
  sep.Plant AS Plant,
  sep.StorageLocation AS StorageLocation,
  sep.Batch AS Batch,
  sep.Supplier AS Supplier,
  sep.SalesOrder AS SalesOrder,
  sep.SalesOrderItem AS SalesOrderItem,
  case when sep.WBSElementInternalID = '00000000' then '' else _WBSElement.WBSElement end AS WBSElement,
  sep.Customer AS Customer,
  sep.StockOwner AS StockOwner,
  sep.InventoryStockType AS InventoryStockType,
  sep.InventorySpecialStockType AS InventorySpecialStockType,
  sep.MaterialBaseUnit AS MaterialBaseUnit,
  sep.WBSElementInternalID AS WBSElementInternalID,
  _CompanyCode.Currency AS CompanyCodeCurrency,
  sep.ProductType AS ProductType,
  sep.ProductGroup AS ProductGroup,
  sep.MatlWrhsStkQtyInMatlBaseUnit AS MatlWrhsStkQtyInMatlBaseUnit,
  sep.CurrentDate AS CurrentDate,
  sum( case when MatDoc.PostingDate > sep.CurrentDate then cast( MatDoc.MatlStkChangeQtyInBaseUnit as abap.fltp) when MatDoc.PostingDate is null or MatDoc.PostingDate < sep.PhysicalInventoryLastCountDate then cast( 0 as abap.fltp) when MatDoc.PostingDate = sep.PhysicalInventoryLastCountDate then cast(MatDoc.MatlStkChangeQtyInBaseUnit as abap.fltp) *0.5 / (1.0 + cast(dats_days_between( sep.PhysicalInventoryLastCountDate, sep.CurrentDate ) as abap.fltp)) else cast(MatDoc.MatlStkChangeQtyInBaseUnit as abap.fltp) * (0.5 + cast(dats_days_between( sep.PhysicalInventoryLastCountDate, MatDoc.PostingDate ) as abap.fltp)) / (1.0 + cast(dats_days_between( sep.PhysicalInventoryLastCountDate, sep.CurrentDate ) as abap.fltp)) end ) as AvgStkQtySinceLastCountCorrect AS fltpendasAvgStkQtySinceLastCountCorrect
FROM P_PhysInvtryActvStkSeparatSitn AS sep
LEFT OUTER JOIN P_MatDocRec AS MatDoc ON /* join condition not captured in parsed metadata */
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]
;