I_MATERIALSTOCK_2

CDS View

Material Stock Calculation

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

CDS Views using this table (18)

ViewTypeJoinVDMDescription
A_MatlStkByKeyDteInAcctMod view from COMPOSITE API view by directly consuming I_MaterialStock
A_MatlStkInAcctMod view from COMPOSITE Material Stock
C_MaterialStockActual view from CONSUMPTION Total actual stock quantity
C_MaterialStockByKeyDate view from CONSUMPTION Material Stock at posting date
I_DFS_StkOnPlntStorLocBatLvl view_entity from COMPOSITE Stock on Plant SLoc and Batch Level
I_DFS_StkOnPlntStorLocByWBS view_entity from COMPOSITE Stock on Plant SLoc Batch Level by WBS
I_DFS_UnrstrcdStkOnPlntStorLoc view_entity from COMPOSITE Unrestricted Stock on plant storage loc
I_JITAvailableUnrstrcdStock view_entity from COMPOSITE Unrestricted stock for Material
I_MaterialUnrestrictedUseStock view from COMPOSITE Material Unrestricted Use Stock
I_UnrestrictedUseStkOnPlntLvl view from COMPOSITE Unrestricted Use Stock on Plant Level
P_MaterialKPIStocksForPhysInv view from COMPOSITE
P_MatlStkAtKeyDateInAltUoM1 view from COMPOSITE
P_MatStkQtyValByKeyDateBaseHdr view from COMPOSITE
P_MatStkQtyValOVP1 view from COMPOSITE
P_MfgOrderItemCost view inner COMPOSITE
P_MfgProcgExecBatchStock view from COMPOSITE
P_MfgProcgExecMaterialStock view from COMPOSITE
P_PurgeStockCheck view_entity from COMPOSITE Stock check for purging

Fields (18)

KeyField CDS FieldsUsed in Views
KEY Batch Batch 1
KEY Customer Customer 1
KEY InventorySpecialStockType InventorySpecialStockType 1
KEY Material Material 4
KEY MaterialBaseUnit MaterialBaseUnit 4
KEY Plant Plant 4
KEY SDDocument SalesDocument 1
KEY SDDocumentItem SalesDocumentItem 1
KEY StorageLocation StorageLocation 3
KEY Supplier Supplier 1
KEY WBSElementInternalID WBSElementInternalID 1
_Customer _Customer 1
_InventorySpecialStockType _InventorySpecialStockType 1
_Material _Material 4
_Plant _Plant 1
_StorageLocation _StorageLocation 1
_Supplier _Supplier 1
_UnitOfMeasure _UnitOfMeasure 1
@EndUserText.label: 'Material Stock Calculation'
@AccessControl: {
                  authorizationCheck: #MANDATORY,
                  personalData.blocking: #NOT_REQUIRED   --there are no BP references in table MATDOC with an EndOfPurpose state
                }
@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
      }
@Analytics: { dataCategory:#CUBE,
              internalName:#LOCAL
            }
@Metadata: {
             allowExtensions: true,
             ignorePropagatedAnnotations: true
           }

define view entity I_MaterialStock_2 
as select from I_MaterialStock_Aggr

  association [1..1] to I_Product                   as _Material                      on  $projection.Material = _Material.Product
  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
  association [0..*] to I_ResourceBasic             as _ResourceBasic                 on  $projection.ResourceID   = _ResourceBasic.ResourceID
{
      // 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 cast ( WBSElementInternalID as ps_s4_pspnr preserving type )   as 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

      
  key MaterialBaseUnit,
  key CostEstimate,
  key ResourceID,
  
      @ObjectModel.foreignKey.association: '_CompanyCode'
      CompanyCode,

      // Quantities

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

      // Associations for names and descriptions

      _UnitOfMeasure,
      _Material,
      _CompanyCode,
      _Plant,
      _StorageLocation,
      _Supplier,
      _Customer,
      _SpecialStockIdfgStockOwner,
      _InventoryStockType,
      _InventorySpecialStockType,  
      _InvtryPrcBasicByPeriodEndDate,
      _InventoryPriceByPeriodEndDate,    
//      @API.element.releaseState: #DEPRECATED

//      @API.element.successor: '_InvtryPrcBasicByPeriodEndDate'

//      @VDM.lifecycle.status: #DEPRECATED

//      @VDM.lifecycle.successor: '_InvtryPrcBasicByPeriodEndDate'      

//      _InventoryPriceByPeriodEndDate,

//      _InvtryPrcBasicByPeriodEndDate,

      _CurrentInvtryPrice,
      _ResourceBasic
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MATERIALSTOCK_AGGR"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_CURRENTMATLPRICEBYCOSTEST",
"I_CUSTOMER",
"I_INVENTORYPRICEBYKEYDATE",
"I_INVENTORYSPECIALSTOCKTYPE",
"I_INVENTORYSTOCKTYPE",
"I_INVTRYPRCBASICBYKEYDATE",
"I_PLANT",
"I_PRODUCT",
"I_RESOURCEBASIC",
"I_STORAGELOCATION",
"I_SUPPLIER",
"I_UNITOFMEASURE"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/