P_EnhPhysInvtryActvStkSep
P_EnhPhysInvtryActvStkSep is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_CompanyCode, P_MatDocRec, P_PhysInvtryActvStkSeparator) and exposes 26 fields with key fields Material, Plant, StorageLocation, Batch, Supplier. It has 5 associations to related views.
Data Sources (3)
| Source | Alias | Join Type |
|---|---|---|
| I_CompanyCode | _CompanyCode | inner |
| P_MatDocRec | MatDoc | left_outer |
| P_PhysInvtryActvStkSeparator | sep | from |
Associations (5)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_WBSElementBasicData | _WBSElement | $projection.WBSElementInternalID = _WBSElement.WBSElementInternalID |
| [0..1] | I_FiscalYear | _FiscalYear | _FiscalYear.FiscalYearVariant = _CompanyCode.FiscalYearVariant and _FiscalYear.FiscalYear = _CurrentPeriod.FiscalYear |
| [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 <> '' |
| [0..1] | I_CycleCountingSettings | _CycleCounting | _CycleCounting.CycleCountType = sep.CycleCountType and _CycleCounting.Plant = $projection.Plant |
Annotations (7)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.preserveKey | true | view | |
| AbapCatalog.sqlViewName | PENHACTVSTOCKSEP | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_ALLOWED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view |
Fields (26)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | Material | P_PhysInvtryActvStkSeparator | Material | Vehicle Model |
| KEY | Plant | P_PhysInvtryActvStkSeparator | Plant | Valuation Area |
| KEY | StorageLocation | P_PhysInvtryActvStkSeparator | StorageLocation | StorageLocation |
| KEY | Batch | P_PhysInvtryActvStkSeparator | Batch | Lot No. |
| KEY | Supplier | P_PhysInvtryActvStkSeparator | Supplier | Supplier |
| KEY | SalesOrder | P_PhysInvtryActvStkSeparator | SalesOrder | SD Document |
| KEY | SalesOrderItem | P_PhysInvtryActvStkSeparator | SalesOrderItem | Sales Order Item |
| KEY | WBSElement | |||
| KEY | Customer | P_PhysInvtryActvStkSeparator | Customer | Sold-to Party |
| KEY | StockOwner | P_PhysInvtryActvStkSeparator | StockOwner | Owner of stock |
| KEY | InventoryStockType | P_PhysInvtryActvStkSeparator | InventoryStockType | Stock Type |
| KEY | InventorySpecialStockType | P_PhysInvtryActvStkSeparator | InventorySpecialStockType | Special Stock Type |
| KEY | MaterialBaseUnit | P_PhysInvtryActvStkSeparator | MaterialBaseUnit | Valuation Unit |
| KEY | MaterialIsPostedToStock | P_PhysInvtryActvStkSeparator | MaterialIsPostedToStock | |
| CycleCountType | ||||
| NmbrOfPhysInvtryPerFiscalYear | _CycleCounting | NmbrOfPhysInvtryPerFiscalYear | ||
| PhysInvtryIntvlForCycCounting | _CycleCounting | PhysInvtryIntvlForCycCounting | ||
| PhysInvtryFloatTimeCycCounting | _CycleCounting | PhysInvtryFloatTimeCycCounting | ||
| WBSElementInternalID | P_PhysInvtryActvStkSeparator | WBSElementInternalID | WBS Internal ID | |
| ProductType | ProductType | Product Type Group | ||
| ProductGroup | ProductGroup | Product Sold Group | ||
| CompanyCodeCurrency | I_CompanyCode | Currency | Valuation Crcy | |
| FiscalYearEndDate | _FiscalYear | FiscalYearEndDate | ||
| MatlWrhsStkQtyInMatlBaseUnit | MatlWrhsStkQtyInMatlBaseUnit | Quantity | ||
| CurrentDate | 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_EnhPhysInvtryActvStkSep.
-- 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: PENHACTVSTOCKSEP
CREATE VIEW P_EnhPhysInvtryActvStkSep 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.MaterialIsPostedToStock AS MaterialIsPostedToStock,
cast( sep.CycleCountType as mmim_cycle_count_type ) AS CycleCountType,
_CycleCounting.NmbrOfPhysInvtryPerFiscalYear AS NmbrOfPhysInvtryPerFiscalYear,
_CycleCounting.PhysInvtryIntvlForCycCounting AS PhysInvtryIntvlForCycCounting,
_CycleCounting.PhysInvtryFloatTimeCycCounting AS PhysInvtryFloatTimeCycCounting,
sep.WBSElementInternalID AS WBSElementInternalID,
ProductType,
ProductGroup,
_CompanyCode.Currency AS CompanyCodeCurrency,
_FiscalYear.FiscalYearEndDate AS FiscalYearEndDate,
MatlWrhsStkQtyInMatlBaseUnit,
CurrentDate,
sum( case when MatDoc.PostingDate > CurrentDate then MatlStkChangeQtyInBaseUnit when MatDoc.PostingDate is null or MatDoc.PostingDate < PhysicalInventoryLastCountDate then 0 when MatDoc.PostingDate = PhysicalInventoryLastCountDate then cast(MatlStkChangeQtyInBaseUnit as abap.fltp) *0.5 / (1.0 + cast(dats_days_between( PhysicalInventoryLastCountDate, CurrentDate ) as abap.fltp)) else cast(MatlStkChangeQtyInBaseUnit as abap.fltp) * (0.5 + cast(dats_days_between( PhysicalInventoryLastCountDate, MatDoc.PostingDate ) as abap.fltp)) / (1.0 + cast(dats_days_between( PhysicalInventoryLastCountDate, CurrentDate ) as abap.fltp)) end ) as AvgStkQtySinceLastCountCorrect AS fltpendasAvgStkQtySinceLastCountCorrect
FROM P_PhysInvtryActvStkSeparator 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_FiscalYear AS _FiscalYear ON _FiscalYear.FiscalYearVariant = _CompanyCode.FiscalYearVariant AND _FiscalYear.FiscalYear = _CurrentPeriod.FiscalYear -- 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]
LEFT OUTER JOIN I_CycleCountingSettings AS _CycleCounting ON _CycleCounting.CycleCountType = sep.CycleCountType AND _CycleCounting.Plant = Plant -- association [0..1]
;
Learn More
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- CDS View Annotations — A Complete Guide
- What Is a CDS View in SAP S/4HANA?
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA
- BSEG to ACDOCA: The Universal Journal Migration
- Business Partner Migration: KNA1/LFA1 to BUT000
- Material Document Migration: MSEG/MKPF to MATDOC
- How to Find the Right CDS View for an SAP Table
- BW Extractor to CDS View Migration Guide
- S/4HANA CDS View Deprecation: What You Need to Know
- ABAP CDS View Tutorial — From Basics to Real-World Examples
- RAP and CDS Views — Building Transactional Apps in SAP S/4HANA
- Sales Document Status Migration: VBUP/VBUK Removal in S/4HANA
- CO Tables in S/4HANA: COEP, COBK, COSS, COSP to ACDOCA