I_BATCHDISTINCT

CDS View

Batch information by batch key

I_BATCHDISTINCT is a CDS View in S/4HANA. Batch information by batch key. It contains 3 fields. 7 CDS views read from this table.

CDS Views using this table (7)

ViewTypeJoinVDMDescription
A_WhsePhysInventoryItem view_entity left_outer COMPOSITE Warehouse Physical Inventory Item
I_Batch view from COMPOSITE Batch information
I_MfgProcgExecBatchStock view inner COMPOSITE Batch Stock in Manufacturing Processing Execution
R_BatchCharacteristicTP view_entity inner TRANSACTIONAL Batch Characteristic
R_BatchCharacteristicValueTP view_entity inner TRANSACTIONAL Batch Characteristics Valuation
R_BatchClassTP view_entity inner TRANSACTIONAL Batch Class Assignment
R_BatchTP view_entity from TRANSACTIONAL Batch

Fields (3)

KeyField CDS FieldsUsed in Views
KEY Batch Batch 3
KEY Material Material 3
KEY Plant BatchIdentifyingPlant 3
@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
}