P_BatchWithValuationVH
Batches in Physical Inventory
P_BatchWithValuationVH is a Composite CDS View that provides data about "Batches in Physical Inventory" in SAP S/4HANA. It reads from 3 data sources (I_BatchPlant, I_BatchPlant, I_BatchPlant) and exposes 92 fields with key fields DefinitionOfBatchLevel, Plant, Material, Batch, Plant. It has 3 associations to related views. Part of development package ODATA_MM_IM_PI_MANAGE_COUNT.
Data Sources (3)
| Source | Alias | Join Type |
|---|---|---|
| I_BatchPlant | I_BatchPlant | from |
| I_BatchPlant | I_BatchPlant | union_all |
| I_BatchPlant | I_BatchPlant | union_all |
Associations (3)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [1..1] | I_Product | _Product | $projection.Material = _Product.Product |
| [0..1] | I_ClfnObjectClassForKeyDate | _ClfnObjectClassForKeyDate | $projection.ClfnObjectInternalID = _ClfnObjectClassForKeyDate.ClfnObjectInternalID |
| [0..*] | I_ClfnObjectCharcValForKeyDate | _ClfnObjectCharcValForKeyDate | $projection.ClfnObjectInternalID = _ClfnObjectCharcValForKeyDate.ClfnObjectInternalID |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| EndUserText.label | Batches in Physical Inventory | view | |
| AbapCatalog.dataMaintenance | #RESTRICTED | view | |
| ObjectModel.usageType.sizeCategory | #M | view | |
| ObjectModel.usageType.serviceQuality | #C | view | |
| ObjectModel.usageType.dataClass | #MASTER | view | |
| VDM.viewType | #COMPOSITE | view | |
| VDM.lifecycle.contract.type | #NONE | view | |
| VDM.private | true | view | |
| Metadata.ignorePropagatedAnnotations | true | view | |
| Consumption.ranked | true | view |
Fields (92)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | DefinitionOfBatchLevel | |||
| KEY | Plant | I_BatchPlant | Plant | Valuation Area |
| KEY | Material | I_BatchPlant | Material | Vehicle Model |
| KEY | Batch | I_BatchPlant | Batch | Lot No. |
| ValuationType | ||||
| BatchIsMarkedForDeletion | I_BatchPlant | BatchIsMarkedForDeletion | Stock del. flag | |
| MatlBatchIsInRstrcdUseStock | I_BatchPlant | MatlBatchIsInRstrcdUseStock | Batch restr. | |
| Supplier | I_BatchPlant | Supplier | Supplier | |
| BatchBySupplier | I_BatchPlant | BatchBySupplier | Supplier Batch | |
| CountryOfOrigin | I_BatchPlant | CountryOfOrigin | Country/Region of Origin | |
| RegionOfOrigin | I_BatchPlant | RegionOfOrigin | Reg. of Origin | |
| MatlBatchAvailabilityDate | I_BatchPlant | MatlBatchAvailabilityDate | Available from | |
| ShelfLifeExpirationDate | I_BatchPlant | ShelfLifeExpirationDate | SLED/BBD | |
| ManufactureDate | I_BatchPlant | ManufactureDate | Date of Manuf. | |
| FreeDefinedDate1 | I_BatchPlant | FreeDefinedDate1 | ||
| FreeDefinedDate2 | I_BatchPlant | FreeDefinedDate2 | ||
| FreeDefinedDate3 | I_BatchPlant | FreeDefinedDate3 | ||
| FreeDefinedDate4 | I_BatchPlant | FreeDefinedDate4 | ||
| FreeDefinedDate5 | I_BatchPlant | FreeDefinedDate5 | ||
| FreeDefinedDate6 | I_BatchPlant | FreeDefinedDate6 | ||
| CreationDateTime | I_BatchPlant | CreationDateTime | Timestamp | |
| LastChangeDateTime | I_BatchPlant | LastChangeDateTime | Timestamp | |
| ClfnObjectInternalID | I_BatchPlant | ClfnObjectInternalID | Int. Object No. | |
| BatchExtWhseMgmtInternalId | I_BatchPlant | BatchExtWhseMgmtInternalId | UUID | |
| _Plant | I_BatchPlant | _Plant | ||
| _Material | I_BatchPlant | _Material | ||
| _Supplier | I_BatchPlant | _Supplier | ||
| _CountryOfOrigin | I_BatchPlant | _CountryOfOrigin | ||
| _RegionOfOrigin | I_BatchPlant | _RegionOfOrigin | ||
| _Product | _Product | |||
| _ClfnObjectClassForKeyDate | _ClfnObjectClassForKeyDate | |||
| KEY | Plant | I_BatchPlant | Plant | Valuation Area |
| KEY | Material | I_BatchPlant | Material | Vehicle Model |
| KEY | Batch | I_BatchPlant | Batch | Lot No. |
| ValuationType | ||||
| BatchIsMarkedForDeletion | I_BatchCrossPlant | BatchIsMarkedForDeletion | Stock del. flag | |
| MatlBatchIsInRstrcdUseStock | I_BatchCrossPlant | MatlBatchIsInRstrcdUseStock | Batch restr. | |
| Supplier | I_BatchCrossPlant | Supplier | Supplier | |
| BatchBySupplier | I_BatchCrossPlant | BatchBySupplier | Supplier Batch | |
| CountryOfOrigin | I_BatchCrossPlant | CountryOfOrigin | Country/Region of Origin | |
| RegionOfOrigin | I_BatchCrossPlant | RegionOfOrigin | Reg. of Origin | |
| MatlBatchAvailabilityDate | I_BatchCrossPlant | MatlBatchAvailabilityDate | Available from | |
| ShelfLifeExpirationDate | I_BatchCrossPlant | ShelfLifeExpirationDate | SLED/BBD | |
| ManufactureDate | I_BatchCrossPlant | ManufactureDate | Date of Manuf. | |
| FreeDefinedDate1 | I_BatchCrossPlant | FreeDefinedDate1 | ||
| FreeDefinedDate2 | I_BatchCrossPlant | FreeDefinedDate2 | ||
| FreeDefinedDate3 | I_BatchCrossPlant | FreeDefinedDate3 | ||
| FreeDefinedDate4 | I_BatchCrossPlant | FreeDefinedDate4 | ||
| FreeDefinedDate5 | I_BatchCrossPlant | FreeDefinedDate5 | ||
| FreeDefinedDate6 | I_BatchCrossPlant | FreeDefinedDate6 | ||
| CreationDateTime | I_BatchPlant | CreationDateTime | Timestamp | |
| LastChangeDateTime | I_BatchPlant | LastChangeDateTime | Timestamp | |
| ClfnObjectInternalID | I_BatchCrossPlant | ClfnObjectInternalID | Int. Object No. | |
| BatchExtWhseMgmtInternalId | I_BatchPlant | BatchExtWhseMgmtInternalId | UUID | |
| _Plant | I_BatchPlant | _Plant | ||
| _Material | I_BatchPlant | _Material | ||
| _Supplier | I_BatchCrossPlant | _Supplier | ||
| _CountryOfOrigin | I_BatchCrossPlant | _CountryOfOrigin | ||
| _RegionOfOrigin | I_BatchCrossPlant | _RegionOfOrigin | ||
| _Product | _Product | |||
| _ClfnObjectClassForKeyDate | _ClfnObjectClassForKeyDate | |||
| KEY | Plant | I_BatchPlant | Plant | Valuation Area |
| KEY | Material | I_BatchPlant | Material | Vehicle Model |
| KEY | Batch | I_BatchPlant | Batch | Lot No. |
| ValuationType | ||||
| BatchIsMarkedForDeletion | I_BatchCrossPlant | BatchIsMarkedForDeletion | Stock del. flag | |
| MatlBatchIsInRstrcdUseStock | I_BatchCrossPlant | MatlBatchIsInRstrcdUseStock | Batch restr. | |
| Supplier | I_BatchCrossPlant | Supplier | Supplier | |
| BatchBySupplier | I_BatchCrossPlant | BatchBySupplier | Supplier Batch | |
| CountryOfOrigin | I_BatchCrossPlant | CountryOfOrigin | Country/Region of Origin | |
| RegionOfOrigin | I_BatchCrossPlant | RegionOfOrigin | Reg. of Origin | |
| MatlBatchAvailabilityDate | I_BatchCrossPlant | MatlBatchAvailabilityDate | Available from | |
| ShelfLifeExpirationDate | I_BatchCrossPlant | ShelfLifeExpirationDate | SLED/BBD | |
| ManufactureDate | I_BatchCrossPlant | ManufactureDate | Date of Manuf. | |
| FreeDefinedDate1 | I_BatchCrossPlant | FreeDefinedDate1 | ||
| FreeDefinedDate2 | I_BatchCrossPlant | FreeDefinedDate2 | ||
| FreeDefinedDate3 | I_BatchCrossPlant | FreeDefinedDate3 | ||
| FreeDefinedDate4 | I_BatchCrossPlant | FreeDefinedDate4 | ||
| FreeDefinedDate5 | I_BatchCrossPlant | FreeDefinedDate5 | ||
| FreeDefinedDate6 | I_BatchCrossPlant | FreeDefinedDate6 | ||
| CreationDateTime | I_BatchPlant | CreationDateTime | Timestamp | |
| LastChangeDateTime | I_BatchPlant | LastChangeDateTime | Timestamp | |
| ClfnObjectInternalID | I_BatchCrossPlant | ClfnObjectInternalID | Int. Object No. | |
| BatchExtWhseMgmtInternalId | I_BatchPlant | BatchExtWhseMgmtInternalId | UUID | |
| _Plant | I_BatchPlant | _Plant | ||
| _Material | I_BatchPlant | _Material | ||
| _Supplier | I_BatchCrossPlant | _Supplier | ||
| _CountryOfOrigin | I_BatchCrossPlant | _CountryOfOrigin | ||
| _RegionOfOrigin | I_BatchCrossPlant | _RegionOfOrigin | ||
| _Product | _Product | |||
| _ClfnObjectClassForKeyDate | _ClfnObjectClassForKeyDate | |||
| _ClfnObjectCharcValForKeyDate | _ClfnObjectCharcValForKeyDate |
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_BatchWithValuationVH.
-- 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_BatchWithValuationVH AS
SELECT
cast('0' as kzdch) AS DefinitionOfBatchLevel,
I_BatchPlant.Plant AS Plant,
I_BatchPlant.Material AS Material,
I_BatchPlant.Batch AS Batch,
cast(I_BatchPlant.InventoryValuationType as bwtar_d) AS ValuationType,
I_BatchPlant.BatchIsMarkedForDeletion AS BatchIsMarkedForDeletion,
I_BatchPlant.MatlBatchIsInRstrcdUseStock AS MatlBatchIsInRstrcdUseStock,
I_BatchPlant.Supplier AS Supplier,
I_BatchPlant.BatchBySupplier AS BatchBySupplier,
I_BatchPlant.CountryOfOrigin AS CountryOfOrigin,
I_BatchPlant.RegionOfOrigin AS RegionOfOrigin,
I_BatchPlant.MatlBatchAvailabilityDate AS MatlBatchAvailabilityDate,
I_BatchPlant.ShelfLifeExpirationDate AS ShelfLifeExpirationDate,
I_BatchPlant.ManufactureDate AS ManufactureDate,
I_BatchPlant.FreeDefinedDate1 AS FreeDefinedDate1,
I_BatchPlant.FreeDefinedDate2 AS FreeDefinedDate2,
I_BatchPlant.FreeDefinedDate3 AS FreeDefinedDate3,
I_BatchPlant.FreeDefinedDate4 AS FreeDefinedDate4,
I_BatchPlant.FreeDefinedDate5 AS FreeDefinedDate5,
I_BatchPlant.FreeDefinedDate6 AS FreeDefinedDate6,
I_BatchPlant.CreationDateTime AS CreationDateTime,
I_BatchPlant.LastChangeDateTime AS LastChangeDateTime,
I_BatchPlant.ClfnObjectInternalID AS ClfnObjectInternalID,
I_BatchPlant.BatchExtWhseMgmtInternalId AS BatchExtWhseMgmtInternalId,
I_BatchPlant._Plant AS _Plant,
I_BatchPlant._Material AS _Material,
I_BatchPlant._Supplier AS _Supplier,
I_BatchPlant._CountryOfOrigin AS _CountryOfOrigin,
I_BatchPlant._RegionOfOrigin AS _RegionOfOrigin
FROM I_BatchPlant
LEFT OUTER JOIN I_Product AS _Product ON Material = _Product.Product -- association [1..1]
LEFT OUTER JOIN I_ClfnObjectClassForKeyDate AS _ClfnObjectClassForKeyDate ON ClfnObjectInternalID = _ClfnObjectClassForKeyDate.ClfnObjectInternalID -- association [0..1]
LEFT OUTER JOIN I_ClfnObjectCharcValForKeyDate AS _ClfnObjectCharcValForKeyDate ON ClfnObjectInternalID = _ClfnObjectCharcValForKeyDate.ClfnObjectInternalID -- association [0..*]
-- UNION ALL with additional select branch(es): I_BatchPlant
;
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