P_EnhPhysInvtryActvStkSepVal

DDL: P_ENHPHYSINVTRYACTVSTKSEPVAL Type: view_entity COMPOSITE Package: ODATA_MM_IM_PI_MASS_CREATE

Active stock separators for which a PI count can be done

P_EnhPhysInvtryActvStkSepVal is a Composite CDS View that provides data about "Active stock separators for which a PI count can be done" in SAP S/4HANA. It reads from 2 data sources (P_PhysInvtryDocItemPerYear, P_EnhPhysInvtryActvStkSep) and exposes 41 fields with key fields Material, Plant, StorageLocation, Batch, Supplier. It has 1 association to related views. Part of development package ODATA_MM_IM_PI_MASS_CREATE.

Data Sources (2)

SourceAliasJoin Type
P_PhysInvtryDocItemPerYear P_PhysInvtryDocItemPerYear left_outer
P_EnhPhysInvtryActvStkSep sep from

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_ProductPlantBasic _ProductPlantBasic $projection.Material = _ProductPlantBasic.Product and $projection.Plant = _ProductPlantBasic.Plant

Annotations (3)

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

Fields (41)

KeyFieldSource TableSource FieldDescription
KEY Material
KEY Plant P_EnhPhysInvtryActvStkSep Plant Valuation Area
KEY StorageLocation
KEY Batch P_EnhPhysInvtryActvStkSep Batch Lot No.
KEY Supplier P_EnhPhysInvtryActvStkSep Supplier Supplier
KEY SalesOrder P_EnhPhysInvtryActvStkSep SalesOrder SD Document
KEY SalesOrderItem P_EnhPhysInvtryActvStkSep SalesOrderItem Sales Order Item
KEY WBSElement P_EnhPhysInvtryActvStkSep WBSElement WBS Internal ID
KEY Customer P_EnhPhysInvtryActvStkSep Customer Sold-to Party
KEY StockOwner P_EnhPhysInvtryActvStkSep StockOwner Owner of stock
KEY InventoryStockType P_EnhPhysInvtryActvStkSep InventoryStockType Stock Type
KEY InventorySpecialStockType P_EnhPhysInvtryActvStkSep InventorySpecialStockType Special Stock Type
KEY MaterialBaseUnit P_EnhPhysInvtryActvStkSep MaterialBaseUnit Valuation Unit
KEY MaterialIsPostedToStock P_EnhPhysInvtryActvStkSep MaterialIsPostedToStock
Batchendascharg_dasRealProductBatch
CycleCountType P_EnhPhysInvtryActvStkSep CycleCountType Cycle Count Type
NmbrOfPhysInvtryPerFiscalYear P_EnhPhysInvtryActvStkSep NmbrOfPhysInvtryPerFiscalYear
PhysInvtryIntvlForCycCounting P_EnhPhysInvtryActvStkSep PhysInvtryIntvlForCycCounting
PhysInvtryFloatTimeCycCounting P_EnhPhysInvtryActvStkSep PhysInvtryFloatTimeCycCounting
WBSElementInternalID P_EnhPhysInvtryActvStkSep WBSElementInternalID WBS Internal ID
ProductType P_EnhPhysInvtryActvStkSep ProductType Product Type Group
ProductGroup P_EnhPhysInvtryActvStkSep ProductGroup Product Sold Group
CompanyCodeCurrency P_EnhPhysInvtryActvStkSep CompanyCodeCurrency Local Currency
MatlWrhsStkQtyInMatlBaseUnit P_EnhPhysInvtryActvStkSep MatlWrhsStkQtyInMatlBaseUnit Quantity
SalesOrderelseendasSalesOrderVal
InventoryValuationType
SearchForValuationType batch InventoryValuationType Valuation Type
PhysicalInventoryLastCountDate P_EnhPhysInvtryActvStkSep PhysicalInventoryLastCountDate Count Date
NumberOfPhysInventoryCounts P_EnhPhysInvtryActvStkSep NumberOfPhysInventoryCounts
NmbrOfDaysSinceLastPInvCount P_EnhPhysInvtryActvStkSep NmbrOfDaysSinceLastPInvCount
PhysicalInventoryItemIsCounted P_EnhPhysInvtryActvStkSep PhysicalInventoryItemIsCounted Is Counted
GdsIssQtySinceLastCountInBsUnt
AvgStkQtySinceLastCountCorrect
DifferenceAmtPerYrInCoCodeCrcy _PIPerYear DifferenceAmtPerYrInCoCodeCrcy
NrOfGdsMvtSinceLastPInvCnt
NumberOfPInvAdjustmentsPerYear
PInvDiffQtyPerYearInBaseUnit
NrOfGdsRcptSinceLastPInvCount
GdsRcptQtySinceLastCtInBsUnt
NrOfGoodsIssSinceLastPInvCount
CurrentDate P_EnhPhysInvtryActvStkSep CurrentDate

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_EnhPhysInvtryActvStkSepVal.
-- 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_EnhPhysInvtryActvStkSepVal AS
SELECT
  cast(sep.Material as matnr preserving type) AS Material,
  sep.Plant AS Plant,
  cast(sep.StorageLocation as pi_storage_location preserving type) AS StorageLocation,
  sep.Batch AS Batch,
  sep.Supplier AS Supplier,
  sep.SalesOrder AS SalesOrder,
  sep.SalesOrderItem AS SalesOrderItem,
  sep.WBSElement AS WBSElement,
  sep.Customer AS Customer,
  sep.StockOwner AS StockOwner,
  sep.InventoryStockType AS InventoryStockType,
  sep.InventorySpecialStockType AS InventorySpecialStockType,
  sep.MaterialBaseUnit AS MaterialBaseUnit,
  sep.MaterialIsPostedToStock AS MaterialIsPostedToStock,
  cast( case when ( _ProductPlantBasic.ValuationCategory <> '' and _ProductPlantBasic.IsBatchManagementRequired = '' ) then ( '' ) else ( sep.Batch ) end as charg_d ) as RealProductBatch AS Batchendascharg_dasRealProductBatch,
  sep.CycleCountType AS CycleCountType,
  sep.NmbrOfPhysInvtryPerFiscalYear AS NmbrOfPhysInvtryPerFiscalYear,
  sep.PhysInvtryIntvlForCycCounting AS PhysInvtryIntvlForCycCounting,
  sep.PhysInvtryFloatTimeCycCounting AS PhysInvtryFloatTimeCycCounting,
  sep.WBSElementInternalID AS WBSElementInternalID,
  sep.ProductType AS ProductType,
  sep.ProductGroup AS ProductGroup,
  sep.CompanyCodeCurrency AS CompanyCodeCurrency,
  sep.MatlWrhsStkQtyInMatlBaseUnit AS MatlWrhsStkQtyInMatlBaseUnit,
  case when ( sep.InventorySpecialStockType = 'E' or sep.InventorySpecialStockType = 'F' ) and sd.InventorySpecialStockValnType = 'M' then sep.SalesOrder else '' end as SalesOrderVal AS SalesOrderelseendasSalesOrderVal,
  coalesce(batch.InventoryValuationType, '') AS InventoryValuationType,
  batch.InventoryValuationType AS SearchForValuationType,
  sep.PhysicalInventoryLastCountDate AS PhysicalInventoryLastCountDate,
  sep.NumberOfPhysInventoryCounts AS NumberOfPhysInventoryCounts,
  sep.NmbrOfDaysSinceLastPInvCount AS NmbrOfDaysSinceLastPInvCount,
  sep.PhysicalInventoryItemIsCounted AS PhysicalInventoryItemIsCounted,
  cast(sep.GdsIssQtySinceLastCountInBsUnt as pi_gi_qty_since_last_cnt) AS GdsIssQtySinceLastCountInBsUnt,
  FLTP_TO_DEC( sep.AvgStkQtySinceLastCountCorrect as abap.dec(31,14) ) AS AvgStkQtySinceLastCountCorrect,
  _PIPerYear.DifferenceAmtPerYrInCoCodeCrcy AS DifferenceAmtPerYrInCoCodeCrcy,
  cast(sep.NrOfGdsMvtSinceLastPInvCnt as pi_nr_of_gm_since_last_cnt) AS NrOfGdsMvtSinceLastPInvCnt,
  cast(_PIPerYear.NumberOfPInvAdjustmentsPerYear as pi_nr_of_adjstmnt_per_year) AS NumberOfPInvAdjustmentsPerYear,
  cast(_PIPerYear.PInvDiffQtyPerYearInBaseUnit as pi_difference_qty_per_year) AS PInvDiffQtyPerYearInBaseUnit,
  cast(sep.NrOfGdsRcptSinceLastPInvCount as pi_nr_of_gr_since_last_cnt) AS NrOfGdsRcptSinceLastPInvCount,
  cast(sep.GdsRcptQtySinceLastCtInBsUnt as pi_gr_qty_since_last_cnt) AS GdsRcptQtySinceLastCtInBsUnt,
  cast(sep.NrOfGoodsIssSinceLastPInvCount as pi_nr_of_gi_since_last_cnt) AS NrOfGoodsIssSinceLastPInvCount,
  sep.CurrentDate AS CurrentDate
FROM P_EnhPhysInvtryActvStkSep AS sep
LEFT OUTER JOIN P_PhysInvtryDocItemPerYear ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_ProductPlantBasic AS _ProductPlantBasic ON Material = _ProductPlantBasic.Product AND Plant = _ProductPlantBasic.Plant  -- association [0..1]
;