I_MATERIALSTOCK

CDS View

Material Stock Calculation

I_MATERIALSTOCK is a CDS View in S/4HANA. Material Stock Calculation. It contains 16 fields. 18 CDS views read from this table.

CDS Views using this table (18)

ViewTypeJoinVDMDescription
arun_i_batch_lines view from Batch Stock selection at storage level
ARUN_I_STOCK_LINES view from Physical Stock selection aggregation
arun_i_stora_line view from Storage location stock aggregation
Arun_Stock_Lines view from Aggregate stock for Supply Assignment
Arun_Stock_Menge view from Fetch total physical stock
ARUN_STOCK_TYPE_MENGE view from Select stock based on stock identifier
I_ExsTxMaterialStockAggrgn view from COMPOSITE Aggregate Material stock for Excise Tax
I_JITStkAnlysAtStorLoc view from COMPOSITE Stock Analysis for Material at Storage Location Level
P_AvailSubcontrgStock view from CONSUMPTION Available Stock at Subcontractor
P_BR_RptgInvtryBusinessPlace view from CONSUMPTION Inventory - Business Place
P_Materialaggr view_entity from CONSUMPTION Material Stock Calculation
P_MPE_MaterialPlantSalesStkQty view_entity from CONSUMPTION Sales Ord Stk Qty for Material Plant lvl
P_MPE_MaterialPlantStkQty view_entity from CONSUMPTION Stock Qty for Material in Plant level
P_MPE_MaterialPlantWBSStkQty view_entity from CONSUMPTION WBS Element Stock Qty for Material Plant
P_MPE_MaterialSalesStockQty view_entity from CONSUMPTION Sales Order Stock Qty for Material
P_MPE_MaterialStorageLocStkQty view_entity from CONSUMPTION Stock qty for Material in Stor Loc level
P_MPE_MaterialWBSElementStkQty view_entity from CONSUMPTION WBS Element Stock Qty for Material
P_UnrestrictedStk view from CONSUMPTION Unrestricted Stock

Fields (16)

KeyField CDS FieldsUsed in Views
Batch Batch 5
CompanyCode CompanyCode 3
CostEstimate CostEstimate 1
Customer Customer 1
InventorySpecialStockType InventorySpecialStockType 4
InventoryStockType InventoryStockType 2
Material Material 7
MaterialBaseUnit MaterialBaseUnit 7
MatlWrhsStkQtyInMatlBaseUnit StockQty 1
Plant Plant 7
SDDocument SDDocument 1
SDDocumentItem SDDocumentItem 1
SpecialStockIdfgStockOwner SpecialStockIdfgStockOwner 1
StorageLocation StorageLocation 7
Supplier Supplier 5
WBSElementInternalID WBSElementInternalID 1
@AbapCatalog: {
                sqlViewName: 'IMATERIALSTOCK',
                preserveKey: true,
                compiler.compareFilter: true
              }
@EndUserText.label: 'Material Stock Calculation'
@AccessControl: {
                  authorizationCheck: #CHECK,
                  personalData.blocking: #NOT_REQUIRED   --there are no BP references in table MATDOC with an EndOfPurpose state
                }
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel: {
                usageType: {
                             sizeCategory: #XXL,
                             serviceQuality: #D,
                             dataClass:#TRANSACTIONAL
                           },
                modelingPattern: #ANALYTICAL_CUBE,
                supportedCapabilities: [#ANALYTICAL_PROVIDER, #SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE]
              }
@VDM: {
        viewType: #COMPOSITE,
        lifecycle.contract.type: #PUBLIC_LOCAL_API,
        lifecycle.status: #DEPRECATED,
        lifecycle.successor: 'I_MaterialStock_2'
      }
@Analytics.dataCategory:#CUBE
@Metadata: {
             allowExtensions: true,
             ignorePropagatedAnnotations: true
           }

/*+[hideWarning] { "IDS" : [ "KEY_CHECK" ] } */

define view I_MaterialStock
  as select from I_MaterialStock_Aggr

  association [1..1] to I_Material                  as _Material                      on  $projection.Material = _Material.Material
  association [1..1] to I_CompanyCode               as _CompanyCode                   on  $projection.CompanyCode = _CompanyCode.CompanyCode
  association [1..1] to I_Plant                     as _Plant                         on  $projection.Plant = _Plant.Plant
  association [0..1] to I_StorageLocation           as _StorageLocation               on  $projection.Plant           = _StorageLocation.Plant
                                                                                      and $projection.StorageLocation = _StorageLocation.StorageLocation
  association [0..1] to I_Supplier                  as _Supplier                      on  $projection.Supplier = _Supplier.Supplier
  association [0..1] to I_Customer                  as _Customer                      on  $projection.Customer = _Customer.Customer
  association [0..1] to I_Supplier                  as _SpecialStockIdfgStockOwner    on  $projection.SpecialStockIdfgStockOwner = _SpecialStockIdfgStockOwner.Supplier
  association [1..1] to I_InventoryStockType        as _InventoryStockType            on  $projection.InventoryStockType = _InventoryStockType.InventoryStockType
  association [1..1] to I_InventorySpecialStockType as _InventorySpecialStockType     on  $projection.InventorySpecialStockType = _InventorySpecialStockType.InventorySpecialStockType
  association [1..1] to I_UnitOfMeasure             as _UnitOfMeasure                 on  $projection.MaterialBaseUnit = _UnitOfMeasure.UnitOfMeasure
-- View I_InvtryPrcBasicByKeyDate deliveres the same data as I_InventoryPriceByKeyDate but is performance optimized for stock value calculation from quantities
-- View I_InventoryPriceByKeyDate has to stay for compatibility reasons (I_MaterialStock is C1 released)
  association [0..1] to I_InvtryPrcBasicByKeyDate   as _InvtryPrcBasicByPeriodEndDate on  $projection.CostEstimate = _InvtryPrcBasicByPeriodEndDate.CostEstimate
  association [0..1] to I_InventoryPriceByKeyDate   as _InventoryPriceByPeriodEndDate on  $projection.CostEstimate = _InventoryPriceByPeriodEndDate.CostEstimate
                                                                                      and _InventoryPriceByPeriodEndDate.CurrencyRole = '10'
  association [0..1] to I_CurrentMatlPriceByCostEst as _CurrentInvtryPrice            on  $projection.CostEstimate = _CurrentInvtryPrice.CostEstimate
{
      // Stock Identifier

      @ObjectModel.foreignKey.association: '_Material'
  key Material,
      @ObjectModel.foreignKey.association: '_Plant'
  key Plant,
      @ObjectModel.foreignKey.association: '_StorageLocation'
  key StorageLocation,
  key Batch,
      @ObjectModel.foreignKey.association: '_Supplier'
  key Supplier,
  key SDDocument,
  key SDDocumentItem,
  key WBSElementInternalID,
      @ObjectModel.foreignKey.association: '_Customer'
  key Customer,
      @ObjectModel.foreignKey.association: '_SpecialStockIdfgStockOwner'
  key SpecialStockIdfgStockOwner,    
      @ObjectModel.foreignKey.association: '_InventoryStockType'
  key InventoryStockType,
      @ObjectModel.foreignKey.association: '_InventorySpecialStockType'
  key InventorySpecialStockType,
      // Further Stock Groups

      @Semantics.fiscal.yearVariant: true
  key FiscalYearVariant,
      @Semantics.businessDate.at: true
  key MatlDocLatestPostgDate,
      // Units

      @Semantics.unitOfMeasure: true
  key MaterialBaseUnit,
      CostEstimate,
      @ObjectModel.foreignKey.association: '_CompanyCode'
      CompanyCode,

      // Quantities

      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @DefaultAggregation : #SUM
      MatlWrhsStkQtyInMatlBaseUnit,
      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @DefaultAggregation : #SUM
      MatlCnsmpnQtyInMatlBaseUnit,
      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @DefaultAggregation : #SUM
      MatlStkIncrQtyInMatlBaseUnit,
      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @DefaultAggregation : #SUM
      MatlStkDecrQtyInMatlBaseUnit,

      // Associations for names and descriptions

      _UnitOfMeasure,
      _Material,
      _CompanyCode,
      _Plant,
      _StorageLocation,
      _Supplier,
      _Customer,
      _SpecialStockIdfgStockOwner,
      _InventoryStockType,
      _InventorySpecialStockType,
      _InvtryPrcBasicByPeriodEndDate,
      _InventoryPriceByPeriodEndDate,
      _CurrentInvtryPrice
}                              
  
  
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MATERIALSTOCK_AGGR"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_CURRENTMATLPRICEBYCOSTEST",
"I_CUSTOMER",
"I_INVENTORYPRICEBYKEYDATE",
"I_INVENTORYSPECIALSTOCKTYPE",
"I_INVENTORYSTOCKTYPE",
"I_INVTRYPRCBASICBYKEYDATE",
"I_MATERIAL",
"I_PLANT",
"I_STORAGELOCATION",
"I_SUPPLIER",
"I_UNITOFMEASURE"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/