I_BatchDistinct
Batch information by batch key
I_BatchDistinct (Composite)
Package: Explore, extend and adapt the SAP S/4HANA Cloud Private Edition with built-in and side-by-side extension capabilities.
Manufacturing
I_BatchDistinct is a Composite CDS View (Dimension) that provides data about "Batch information by batch key" in SAP S/4HANA. It reads from 4 data sources (I_BatchConfiguration, I_BatchConfiguration, I_BatchCrossPlant, P_BatchPlant) and exposes 77 fields with key fields Plant, Material, Batch, Material, Batch. It has 5 associations to related views.
SAP API Hub
| State | C1 |
|---|---|
| Line of Business | Manufacturing |
| Application Component | LO-BM-MD |
| Capabilities | Data Source in SQL Select, Association Target for Defining CDS Entities, Data Source for Defining CDS Entities, Analytical Dimension |
| Package | Manufacturing for SAP S/4HANA Cloud Private Edition |
| Description | <p>This CDS view provides the prerequisites for answering the following business questions:</p> <ul> <li><p>When will the shelf life of the batch expire?</p></li> <li><p>To which supplier can a batch be traced?</p></li> <li><p>Where and when was the batch manufactured?</p></li> <li><p>Which batches are available for unrestricted use?</p></li> </ul> |
Documentation
- Analytics with CDS Views — Build Analytics for S/4HANA Cloud Private Edition ABAP CDS views replicated to SAP Cloud Platform
- CDS Views on SAP Business Accelerator Hub — Explore SAP S/4HANA Cloud Private Edition Private Edition CDS Views on SAP Business Accelerator Hub
- Create CDS View as API — Create CDS views in SAP S/4HANA Cloud Private Edition and consume them as APIs
- Custom CDS Views — Access data using a Custom Core Data Service view (Custom CDS view)
- Key User Extensibility Tools — The Key User Extensibility Tools of S/4HANA
- SAP Extensibility Explorer for SAP S/4HANA Cloud Private Edition — Explore SAP S/4HANA Cloud Private Edition Extensibility options by leveraging the sample scenarios from SAP
- SAP S/4HANA Extensibility — SAP S/4HANA Extensibility Tutorial
- VDM View Types — The Virtual Data Model in SAP S/4HANA Cloud Private Edition
- View Browser — Search, browse and tag CDS Views
Data Sources (4)
| Source | Alias | Join Type |
|---|---|---|
| I_BatchConfiguration | I_BatchConfiguration | inner |
| I_BatchConfiguration | I_BatchConfiguration | inner |
| I_BatchCrossPlant | I_BatchCrossPlant | from |
| P_BatchPlant | P_BatchPlant | union_all |
Associations (5)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_Plant | _Plant | $projection.Plant = _Plant.Plant |
| [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 |
| [0..*] | I_BatchDistinctText | _BatchDistinctText | $projection.Batch = _BatchDistinctText.Batch and $projection.Material = _BatchDistinctText.Material and $projection.Plant = _BatchDistinctText.Plant |
Annotations (15)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | IBATCHDISTINCT | view | |
| AbapCatalog.preserveKey | true | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| EndUserText.label | Batch information by batch key | view | |
| AccessControl.authorizationCheck | #CHECK | view | |
| ObjectModel.usageType.sizeCategory | #L | view | |
| ObjectModel.usageType.serviceQuality | #C | view | |
| ObjectModel.usageType.dataClass | #MASTER | view | |
| ObjectModel.representativeKey | Batch | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| VDM.viewType | #COMPOSITE | view | |
| VDM.lifecycle.contract.type | #PUBLIC_LOCAL_API | view | |
| Analytics.dataCategory | #DIMENSION | view | |
| Metadata.allowExtensions | true | view | |
| Metadata.ignorePropagatedAnnotations | true | view |
Fields (77)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | Plant | Plant | ||
| KEY | Material | Material | Material Number | |
| KEY | Batch | Batch | Batch Number | |
| BatchIsMarkedForDeletion | BatchIsMarkedForDeletion | Deletion Flag for All Data in a Batch | ||
| MatlBatchIsInRstrcdUseStock | MatlBatchIsInRstrcdUseStock | Batch in Restricted-Use Stock | ||
| Supplier | Supplier | Supplier's Account Number | ||
| BatchBySupplier | BatchBySupplier | Supplier Batch Number | ||
| CountryOfOrigin | CountryOfOrigin | Country/Region of Origin of Material (Non-Preferential Ori.) | ||
| RegionOfOrigin | RegionOfOrigin | Region of Origin of Material (Non-Preferential Origin) | ||
| MatlBatchAvailabilityDate | MatlBatchAvailabilityDate | Availability date | ||
| ShelfLifeExpirationDate | ShelfLifeExpirationDate | Shelf Life Expiration or Best-Before Date | ||
| ManufactureDate | ManufactureDate | Date of Manufacture | ||
| NextInspectionDate | NextInspectionDate | Next Inspection Date | ||
| LastGoodsReceiptDate | LastGoodsReceiptDate | Date of last goods receipt | ||
| FreeDefinedDate1 | FreeDefinedDate1 | Date for Free Use 1 | ||
| FreeDefinedDate2 | FreeDefinedDate2 | Date for Free Use 2 | ||
| FreeDefinedDate3 | FreeDefinedDate3 | Date for Free Use 3 | ||
| FreeDefinedDate4 | FreeDefinedDate4 | Date for Free Use 4 | ||
| FreeDefinedDate5 | FreeDefinedDate5 | Date for Free Use 5 | ||
| FreeDefinedDate6 | FreeDefinedDate6 | Date for Free Use 6 | ||
| DefinitionOfBatchLevel | DefinitionOfBatchLevel | Indicator: definition of batch management level | ||
| BatchCertificationDate | BatchCertificationDate | Date of Certification | ||
| CreationDateTime | CreationDateTime | Created On Timestamp | ||
| LastChangeDateTime | LastChangeDateTime | Last Change Timestamp | ||
| ClfnObjectInternalID | ClfnObjectInternalID | Internal object no.: Batch classification | ||
| BatchExtWhseMgmtInternalId | BatchExtWhseMgmtInternalId | Batch ID | ||
| StockSegment | StockSegment | Stock Segment | ||
| ExportAndImportProductGroup | ExportAndImportProductGroup | Material Group for Intrastat | ||
| InventoryValuationType | Valuation Type | |||
| BatchVersion | BatchVersion | Version of a batch | ||
| _Plant | _Plant | |||
| _Material | _Material | |||
| _Supplier | _Supplier | |||
| _CountryOfOrigin | _CountryOfOrigin | |||
| _RegionOfOrigin | _RegionOfOrigin | |||
| _Product | _Product | |||
| _ClfnObjectClassForKeyDate | _ClfnObjectClassForKeyDate | |||
| _ClfnObjectCharcValForKeyDate | _ClfnObjectCharcValForKeyDate | |||
| PlantkeyPlant | ||||
| KEY | Material | Material | Material Number | |
| KEY | Batch | Batch | Batch Number | |
| BatchIsMarkedForDeletion | BatchIsMarkedForDeletion | Deletion Flag for All Data in a Batch | ||
| MatlBatchIsInRstrcdUseStock | MatlBatchIsInRstrcdUseStock | Batch in Restricted-Use Stock | ||
| Supplier | Supplier | Supplier's Account Number | ||
| BatchBySupplier | BatchBySupplier | Supplier Batch Number | ||
| CountryOfOrigin | CountryOfOrigin | Country/Region of Origin of Material (Non-Preferential Ori.) | ||
| RegionOfOrigin | RegionOfOrigin | Region of Origin of Material (Non-Preferential Origin) | ||
| MatlBatchAvailabilityDate | MatlBatchAvailabilityDate | Availability date | ||
| ShelfLifeExpirationDate | ShelfLifeExpirationDate | Shelf Life Expiration or Best-Before Date | ||
| ManufactureDate | ManufactureDate | Date of Manufacture | ||
| NextInspectionDate | NextInspectionDate | Next Inspection Date | ||
| LastGoodsReceiptDate | LastGoodsReceiptDate | Date of last goods receipt | ||
| FreeDefinedDate1 | FreeDefinedDate1 | Date for Free Use 1 | ||
| FreeDefinedDate2 | FreeDefinedDate2 | Date for Free Use 2 | ||
| FreeDefinedDate3 | FreeDefinedDate3 | Date for Free Use 3 | ||
| FreeDefinedDate4 | FreeDefinedDate4 | Date for Free Use 4 | ||
| FreeDefinedDate5 | FreeDefinedDate5 | Date for Free Use 5 | ||
| FreeDefinedDate6 | FreeDefinedDate6 | Date for Free Use 6 | ||
| DefinitionOfBatchLevel | DefinitionOfBatchLevel | Indicator: definition of batch management level | ||
| BatchCertificationDate | BatchCertificationDate | Date of Certification | ||
| CreationDateTime | CreationDateTime | Created On Timestamp | ||
| LastChangeDateTime | LastChangeDateTime | Last Change Timestamp | ||
| ClfnObjectInternalID | ClfnObjectInternalID | Internal object no.: Batch classification | ||
| BatchExtWhseMgmtInternalId | BatchExtWhseMgmtInternalId | Batch ID | ||
| StockSegment | StockSegment | Stock Segment | ||
| ExportAndImportProductGroup | ExportAndImportProductGroup | Material Group for Intrastat | ||
| InventoryValuationType | InventoryValuationType | Valuation Type | ||
| BatchVersion | BatchVersion | Version of a batch | ||
| _Plant | _Plant | |||
| _Material | _Material | |||
| _Supplier | _Supplier | |||
| _CountryOfOrigin | _CountryOfOrigin | |||
| _RegionOfOrigin | _RegionOfOrigin | |||
| _Product | _Product | |||
| _ClfnObjectClassForKeyDate | _ClfnObjectClassForKeyDate | |||
| _ClfnObjectCharcValForKeyDate | _ClfnObjectCharcValForKeyDate | |||
| _BatchDistinctText | _BatchDistinctText |
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 I_BatchDistinct.
-- 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: IBATCHDISTINCT
CREATE VIEW I_BatchDistinct AS
SELECT
cast(' ' as werks_d preserving type) AS Plant,
Material,
Batch,
BatchIsMarkedForDeletion,
MatlBatchIsInRstrcdUseStock,
Supplier,
BatchBySupplier,
CountryOfOrigin,
RegionOfOrigin,
MatlBatchAvailabilityDate,
ShelfLifeExpirationDate,
ManufactureDate,
NextInspectionDate,
LastGoodsReceiptDate,
FreeDefinedDate1,
FreeDefinedDate2,
FreeDefinedDate3,
FreeDefinedDate4,
FreeDefinedDate5,
FreeDefinedDate6,
DefinitionOfBatchLevel,
BatchCertificationDate,
CreationDateTime,
LastChangeDateTime,
ClfnObjectInternalID,
BatchExtWhseMgmtInternalId,
StockSegment,
ExportAndImportProductGroup,
cast( ' ' as bwtar_d preserving type ) AS InventoryValuationType,
BatchVersion
FROM I_BatchCrossPlant
INNER JOIN I_BatchConfiguration ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_Plant AS _Plant ON Plant = _Plant.Plant -- association [0..1]
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..*]
LEFT OUTER JOIN I_BatchDistinctText AS _BatchDistinctText ON Batch = _BatchDistinctText.Batch AND Material = _BatchDistinctText.Material AND Plant = _BatchDistinctText.Plant -- association [0..*]
-- UNION ALL with additional select branch(es): P_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