I_BatchDistinct

DDL: I_BATCHDISTINCT SQL: IBATCHDISTINCT Type: view COMPOSITE

Batch information by batch key

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.

Data Sources (4)

SourceAliasJoin Type
I_BatchConfiguration I_BatchConfiguration inner
I_BatchConfiguration I_BatchConfiguration inner
I_BatchCrossPlant I_BatchCrossPlant from
P_BatchPlant P_BatchPlant union_all

Associations (5)

CardinalityTargetAliasCondition
[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)

NameValueLevelField
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)

KeyFieldSource TableSource FieldDescription
KEY Plant
KEY Material Material
KEY Batch Batch
BatchIsMarkedForDeletion BatchIsMarkedForDeletion
MatlBatchIsInRstrcdUseStock MatlBatchIsInRstrcdUseStock
Supplier Supplier
BatchBySupplier BatchBySupplier
CountryOfOrigin CountryOfOrigin
RegionOfOrigin RegionOfOrigin
MatlBatchAvailabilityDate MatlBatchAvailabilityDate
ShelfLifeExpirationDate ShelfLifeExpirationDate
ManufactureDate ManufactureDate
NextInspectionDate NextInspectionDate
LastGoodsReceiptDate LastGoodsReceiptDate
FreeDefinedDate1 FreeDefinedDate1
FreeDefinedDate2 FreeDefinedDate2
FreeDefinedDate3 FreeDefinedDate3
FreeDefinedDate4 FreeDefinedDate4
FreeDefinedDate5 FreeDefinedDate5
FreeDefinedDate6 FreeDefinedDate6
DefinitionOfBatchLevel DefinitionOfBatchLevel
BatchCertificationDate BatchCertificationDate
CreationDateTime CreationDateTime
LastChangeDateTime LastChangeDateTime
ClfnObjectInternalID ClfnObjectInternalID
BatchExtWhseMgmtInternalId BatchExtWhseMgmtInternalId
StockSegment StockSegment
ExportAndImportProductGroup ExportAndImportProductGroup
InventoryValuationType
BatchVersion BatchVersion
_Plant _Plant
_Material _Material
_Supplier _Supplier
_CountryOfOrigin _CountryOfOrigin
_RegionOfOrigin _RegionOfOrigin
_Product _Product
_ClfnObjectClassForKeyDate _ClfnObjectClassForKeyDate
_ClfnObjectCharcValForKeyDate _ClfnObjectCharcValForKeyDate
PlantkeyPlant
KEY Material Material
KEY Batch Batch
BatchIsMarkedForDeletion BatchIsMarkedForDeletion
MatlBatchIsInRstrcdUseStock MatlBatchIsInRstrcdUseStock
Supplier Supplier
BatchBySupplier BatchBySupplier
CountryOfOrigin CountryOfOrigin
RegionOfOrigin RegionOfOrigin
MatlBatchAvailabilityDate MatlBatchAvailabilityDate
ShelfLifeExpirationDate ShelfLifeExpirationDate
ManufactureDate ManufactureDate
NextInspectionDate NextInspectionDate
LastGoodsReceiptDate LastGoodsReceiptDate
FreeDefinedDate1 FreeDefinedDate1
FreeDefinedDate2 FreeDefinedDate2
FreeDefinedDate3 FreeDefinedDate3
FreeDefinedDate4 FreeDefinedDate4
FreeDefinedDate5 FreeDefinedDate5
FreeDefinedDate6 FreeDefinedDate6
DefinitionOfBatchLevel DefinitionOfBatchLevel
BatchCertificationDate BatchCertificationDate
CreationDateTime CreationDateTime
LastChangeDateTime LastChangeDateTime
ClfnObjectInternalID ClfnObjectInternalID
BatchExtWhseMgmtInternalId BatchExtWhseMgmtInternalId
StockSegment StockSegment
ExportAndImportProductGroup ExportAndImportProductGroup
InventoryValuationType InventoryValuationType
BatchVersion BatchVersion
_Plant _Plant
_Material _Material
_Supplier _Supplier
_CountryOfOrigin _CountryOfOrigin
_RegionOfOrigin _RegionOfOrigin
_Product _Product
_ClfnObjectClassForKeyDate _ClfnObjectClassForKeyDate
_ClfnObjectCharcValForKeyDate _ClfnObjectCharcValForKeyDate
_BatchDistinctText _BatchDistinctText
@AbapCatalog.sqlViewName: 'IBATCHDISTINCT'
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'Batch information by batch key'


@AccessControl.authorizationCheck: #CHECK

@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.dataClass:#MASTER
@ObjectModel.representativeKey: 'Batch'
@ObjectModel.supportedCapabilities: [
  #SQL_DATA_SOURCE,
  #CDS_MODELING_DATA_SOURCE,
  #CDS_MODELING_ASSOCIATION_TARGET,
  #ANALYTICAL_DIMENSION
]

@ClientHandling.algorithm: #SESSION_VARIABLE

@VDM.viewType: #COMPOSITE
@VDM.lifecycle.contract.type: #PUBLIC_LOCAL_API 

@Analytics.dataCategory: #DIMENSION

@Metadata.allowExtensions:true
@Metadata.ignorePropagatedAnnotations:true
define view I_BatchDistinct as 
// This view part only returns data if the DefinitionOfBatchLevel is '1' or '2' in I_BatchConfiguration.

select from I_BatchCrossPlant 
inner join I_BatchConfiguration on DefinitionOfBatchLevel <> '0'

association [0..1] to I_Plant                     as _Plant                         on  $projection.Plant    = _Plant.Plant
association [1..1] to I_Product                   as _Product                       on  $projection.Material = _Product.Product
association [0..1] to I_ClfnObjectClassForKeyDate as _ClfnObjectClassForKeyDate     on  $projection.ClfnObjectInternalID = _ClfnObjectClassForKeyDate.ClfnObjectInternalID
association [0..*] to I_ClfnObjectCharcValForKeyDate as _ClfnObjectCharcValForKeyDate on  $projection.ClfnObjectInternalID = _ClfnObjectCharcValForKeyDate.ClfnObjectInternalID
association [0..*] to I_BatchDistinctText         as  _BatchDistinctText   on  $projection.Batch = _BatchDistinctText.Batch 
                                                                           and $projection.Material = _BatchDistinctText.Material 
                                                                           and $projection.Plant =  _BatchDistinctText.Plant
{
    @ObjectModel.foreignKey.association: '_Plant'
    key cast('    ' as werks_d preserving type) as Plant,
    @ObjectModel.foreignKey.association: '_Product'
    key Material,
    @ObjectModel.text.association: '_BatchDistinctText'
    key Batch,
     
    BatchIsMarkedForDeletion,

    MatlBatchIsInRstrcdUseStock,

   
    @ObjectModel.foreignKey.association: '_Supplier'
    Supplier,
    BatchBySupplier,
    @ObjectModel.foreignKey.association: '_CountryOfOrigin'
    CountryOfOrigin,
    @ObjectModel.foreignKey.association: '_RegionOfOrigin'
    RegionOfOrigin,
    
    MatlBatchAvailabilityDate,
    ShelfLifeExpirationDate,
    ManufactureDate,
    NextInspectionDate,
    LastGoodsReceiptDate,
    FreeDefinedDate1,
    FreeDefinedDate2,
    FreeDefinedDate3,
    FreeDefinedDate4,
    FreeDefinedDate5,
    FreeDefinedDate6,
    DefinitionOfBatchLevel,
    BatchCertificationDate,
    @Semantics.systemDateTime.createdAt: true
    CreationDateTime,
    @Semantics.systemDateTime.lastChangedAt: true
    LastChangeDateTime,
    
    ClfnObjectInternalID,
    BatchExtWhseMgmtInternalId,
    StockSegment,
    ExportAndImportProductGroup,
    cast( '          ' as bwtar_d preserving type ) as InventoryValuationType,
    BatchVersion,

    _Plant,
    _Material,
    _Supplier,
    _CountryOfOrigin,
    _RegionOfOrigin,
    _Product,
    _ClfnObjectClassForKeyDate,
    _ClfnObjectCharcValForKeyDate,
    _BatchDistinctText

}
union all
// Perform an inner join with I_BatchConfiguration to ensure that data is only returned of the customer

// has customized the batch configuration to not use I_BatchCrossPlant. (Only possible in OnPremise)

select from P_BatchPlant 
inner join I_BatchConfiguration on DefinitionOfBatchLevel = '0'
association [1..1] to I_Product                   as _Product                       on  $projection.Material = _Product.Product
association [0..1] to I_ClfnObjectClassForKeyDate as _ClfnObjectClassForKeyDate     on  $projection.ClfnObjectInternalID = _ClfnObjectClassForKeyDate.ClfnObjectInternalID
association [0..*] to I_ClfnObjectCharcValForKeyDate as _ClfnObjectCharcValForKeyDate on  $projection.ClfnObjectInternalID = _ClfnObjectCharcValForKeyDate.ClfnObjectInternalID
association [0..*] to I_BatchDistinctText         as  _BatchDistinctText   on  $projection.Batch = _BatchDistinctText.Batch 
                                                                           and $projection.Material = _BatchDistinctText.Material 
                                                                           and $projection.Plant =  _BatchDistinctText.Plant
{
    @ObjectModel.foreignKey.association: '_Plant'
    key Plant,
    @ObjectModel.foreignKey.association: '_Product'
    key Material,
    @ObjectModel.text.association: '_BatchDistinctText'
    key Batch,
    
    BatchIsMarkedForDeletion,

    MatlBatchIsInRstrcdUseStock,
    @ObjectModel.foreignKey.association: '_Supplier'
    Supplier,
    BatchBySupplier,
    @ObjectModel.foreignKey.association: '_CountryOfOrigin'
    CountryOfOrigin,
    @ObjectModel.foreignKey.association: '_RegionOfOrigin'
    RegionOfOrigin,
    
    MatlBatchAvailabilityDate,
    ShelfLifeExpirationDate,
    ManufactureDate,
    NextInspectionDate,
    LastGoodsReceiptDate,
    FreeDefinedDate1,
    FreeDefinedDate2,
    FreeDefinedDate3,
    FreeDefinedDate4,
    FreeDefinedDate5,
    FreeDefinedDate6,
    DefinitionOfBatchLevel,
    BatchCertificationDate,
    @Semantics.systemDateTime.createdAt: true
    CreationDateTime,
    @Semantics.systemDateTime.lastChangedAt: true
    LastChangeDateTime,

    ClfnObjectInternalID,
    BatchExtWhseMgmtInternalId,
    StockSegment,
    ExportAndImportProductGroup,
    InventoryValuationType,
    BatchVersion,
    
    _Plant,
    _Material,
    _Supplier,
    _CountryOfOrigin,
    _RegionOfOrigin,
    _Product,
    _ClfnObjectClassForKeyDate,
    _ClfnObjectCharcValForKeyDate,
    _BatchDistinctText
}