I_Batch

DDL: I_BATCH SQL: IBATCH Type: view COMPOSITE

Batch information

I_Batch is a Composite CDS View (Dimension) that provides data about "Batch information" in SAP S/4HANA. It reads from 4 data sources (I_BatchConfiguration, I_BatchCrossPlant, I_BatchDistinct, P_BatchPlant) and exposes 77 fields with key fields Plant, Material, Batch, Material, Batch. It has 3 associations to related views.

Data Sources (4)

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

Associations (3)

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

NameValueLevelField
AbapCatalog.sqlViewName IBATCH view
AbapCatalog.preserveKey true view
AbapCatalog.compiler.compareFilter true view
EndUserText.label Batch information 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 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
BatchCertificationDate BatchCertificationDate
DefinitionOfBatchLevel DefinitionOfBatchLevel
IsSubordinateBatch
BatchIdentifyingPlant Plant
CreationDateTime CreationDateTime
LastChangeDateTime LastChangeDateTime
ClfnObjectInternalID ClfnObjectInternalID
BatchExtWhseMgmtInternalId BatchExtWhseMgmtInternalId
StockSegment StockSegment
ExportAndImportProductGroup ExportAndImportProductGroup
InventoryValuationType InventoryValuationType
_Plant _Plant
_Material _Material
_Supplier _Supplier
_CountryOfOrigin _CountryOfOrigin
_RegionOfOrigin _RegionOfOrigin
_Product _Product
_ClfnObjectClassForKeyDate _ClfnObjectClassForKeyDate
Plant
KEY Material P_BatchPlant Material
KEY Batch P_BatchPlant Batch
BatchIsMarkedForDeletion I_BatchCrossPlant BatchIsMarkedForDeletion
MatlBatchIsInRstrcdUseStock I_BatchCrossPlant MatlBatchIsInRstrcdUseStock
Supplier I_BatchCrossPlant Supplier
BatchBySupplier I_BatchCrossPlant BatchBySupplier
CountryOfOrigin I_BatchCrossPlant CountryOfOrigin
RegionOfOrigin I_BatchCrossPlant RegionOfOrigin
MatlBatchAvailabilityDate I_BatchCrossPlant MatlBatchAvailabilityDate
ShelfLifeExpirationDate I_BatchCrossPlant ShelfLifeExpirationDate
ManufactureDate I_BatchCrossPlant ManufactureDate
NextInspectionDate I_BatchCrossPlant NextInspectionDate
LastGoodsReceiptDate I_BatchCrossPlant LastGoodsReceiptDate
FreeDefinedDate1 I_BatchCrossPlant FreeDefinedDate1
FreeDefinedDate2 I_BatchCrossPlant FreeDefinedDate2
FreeDefinedDate3 I_BatchCrossPlant FreeDefinedDate3
FreeDefinedDate4 I_BatchCrossPlant FreeDefinedDate4
FreeDefinedDate5 I_BatchCrossPlant FreeDefinedDate5
FreeDefinedDate6 I_BatchCrossPlant FreeDefinedDate6
BatchCertificationDate I_BatchCrossPlant BatchCertificationDate
DefinitionOfBatchLevel
IsSubordinateBatch
BatchIdentifyingPlant
CreationDateTime I_BatchCrossPlant CreationDateTime
LastChangeDateTime I_BatchCrossPlant LastChangeDateTime
ClfnObjectInternalID I_BatchCrossPlant ClfnObjectInternalID
BatchExtWhseMgmtInternalId P_BatchPlant BatchExtWhseMgmtInternalId
StockSegment I_BatchCrossPlant StockSegment
ExportAndImportProductGroup I_BatchCrossPlant ExportAndImportProductGroup
InventoryValuationType P_BatchPlant InventoryValuationType
_Plant _Plant
_Material P_BatchPlant _Material
_Supplier I_BatchCrossPlant _Supplier
_CountryOfOrigin I_BatchCrossPlant _CountryOfOrigin
_RegionOfOrigin I_BatchCrossPlant _RegionOfOrigin
_Product _Product
_ClfnObjectClassForKeyDate _ClfnObjectClassForKeyDate
_ClfnObjectCharcValForKeyDate _ClfnObjectCharcValForKeyDate
@AbapCatalog.sqlViewName: 'IBATCH'
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'Batch information'


@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_Batch as 
select from I_BatchDistinct {
  @ObjectModel.foreignKey.association: '_Plant'
  key Plant,
  @ObjectModel.foreignKey.association: '_Material'
  @Consumption.valueHelpDefinition: [
    { entity:  { name:    'I_MaterialStdVH',
                 element: 'Material' }
    }]
  key Material,
  key Batch,
  BatchIsMarkedForDeletion,

  MatlBatchIsInRstrcdUseStock,
  @ObjectModel.foreignKey.association: '_Supplier'
  @Consumption.valueHelpDefinition: [
    { entity:  { name:    'I_Supplier_VH',
                 element: 'Supplier' }
    }]
  Supplier,
  BatchBySupplier,
  @ObjectModel.foreignKey.association: '_CountryOfOrigin'
  CountryOfOrigin,
  @ObjectModel.foreignKey.association: '_RegionOfOrigin'
  RegionOfOrigin,
  
  MatlBatchAvailabilityDate,
  ShelfLifeExpirationDate,
  ManufactureDate,
  NextInspectionDate,
  LastGoodsReceiptDate,
  FreeDefinedDate1,
  FreeDefinedDate2,
  FreeDefinedDate3,
  FreeDefinedDate4,
  FreeDefinedDate5,
  FreeDefinedDate6,
  BatchCertificationDate,
  DefinitionOfBatchLevel,
  cast(' ' as subordinate_batch preserving type ) as IsSubordinateBatch,
  Plant as BatchIdentifyingPlant,
  
  @Semantics.systemDateTime.createdAt: true
  CreationDateTime,
  @Semantics.systemDateTime.lastChangedAt: true
  LastChangeDateTime,
  
  ClfnObjectInternalID,
  BatchExtWhseMgmtInternalId,
  StockSegment,
  ExportAndImportProductGroup,
  InventoryValuationType,
  
  _Plant,
  _Material,
  _Supplier,
  _CountryOfOrigin,
  _RegionOfOrigin,
  _Product,
  _ClfnObjectClassForKeyDate,
  _ClfnObjectCharcValForKeyDate
}
union all
// Finally consider the case that a customer has cross-plant batches but uses the value help and searches by

// plant. In this case, both tables are filled but the main attributes are on I_BatchCrossPlant. 

// This will lead to additional entries to the first read from I_BatchCrossPlant having the Plant as part of

// the key. It will not lead to additional entries if the batch is not cross-plant as I_BatchCrossPlant would

// be empty in that case and thus the result of the inner join.

select from P_BatchPlant
inner join I_BatchConfiguration on DefinitionOfBatchLevel <> '0'
inner join I_BatchCrossPlant on P_BatchPlant.Material = I_BatchCrossPlant.Material and
                                P_BatchPlant.Batch = I_BatchCrossPlant.Batch         
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
{
    @ObjectModel.foreignKey.association: '_Plant'
    key P_BatchPlant.Plant,
    @ObjectModel.foreignKey.association: '_Material'
    key P_BatchPlant.Material,
    key P_BatchPlant.Batch,
    
    I_BatchCrossPlant.BatchIsMarkedForDeletion,

    I_BatchCrossPlant.MatlBatchIsInRstrcdUseStock,
    @ObjectModel.foreignKey.association: '_Supplier'
    I_BatchCrossPlant.Supplier,
    I_BatchCrossPlant.BatchBySupplier,
    @ObjectModel.foreignKey.association: '_CountryOfOrigin'
    I_BatchCrossPlant.CountryOfOrigin,
    @ObjectModel.foreignKey.association: '_RegionOfOrigin'
    I_BatchCrossPlant.RegionOfOrigin,
    
    I_BatchCrossPlant.MatlBatchAvailabilityDate,
    I_BatchCrossPlant.ShelfLifeExpirationDate,
    I_BatchCrossPlant.ManufactureDate,
    I_BatchCrossPlant.NextInspectionDate,
    I_BatchCrossPlant.LastGoodsReceiptDate,
    I_BatchCrossPlant.FreeDefinedDate1,
    I_BatchCrossPlant.FreeDefinedDate2,
    I_BatchCrossPlant.FreeDefinedDate3,
    I_BatchCrossPlant.FreeDefinedDate4,
    I_BatchCrossPlant.FreeDefinedDate5,
    I_BatchCrossPlant.FreeDefinedDate6,
    I_BatchCrossPlant.BatchCertificationDate,
    cast('1' as kzdch) as DefinitionOfBatchLevel,
    cast('X' as subordinate_batch preserving type ) as IsSubordinateBatch,
    cast('    ' as werks_d preserving type) as BatchIdentifyingPlant, 
    
    @Semantics.systemDateTime.createdAt: true
    I_BatchCrossPlant.CreationDateTime,
    @Semantics.systemDateTime.lastChangedAt: true
    I_BatchCrossPlant.LastChangeDateTime,
    
    I_BatchCrossPlant.ClfnObjectInternalID,
    P_BatchPlant.BatchExtWhseMgmtInternalId,
    I_BatchCrossPlant.StockSegment,
    I_BatchCrossPlant.ExportAndImportProductGroup,
    P_BatchPlant.InventoryValuationType,
    _Plant,
    P_BatchPlant._Material,
    I_BatchCrossPlant._Supplier,
    I_BatchCrossPlant._CountryOfOrigin,
    I_BatchCrossPlant._RegionOfOrigin,
    _Product,
    _ClfnObjectClassForKeyDate,
    _ClfnObjectCharcValForKeyDate
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BATCHCONFIGURATION",
"I_BATCHCROSSPLANT",
"I_BATCHDISTINCT",
"P_BATCHPLANT"
],
"ASSOCIATED":
[
"I_CLFNOBJECTCHARCVALFORKEYDATE",
"I_CLFNOBJECTCLASSFORKEYDATE",
"I_COUNTRY",
"I_MATERIAL",
"I_PLANT",
"I_PRODUCT",
"I_REGION",
"I_SUPPLIER"
],
"BASE":
[
"I_BATCHDISTINCT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/