I_MATERIALSTOCK_2

CDS View

Material Stock Calculation

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

CDS Views using this table (23)

ViewTypeJoinVDMDescription
/VSCEW/C_Disposition_CH view_entity from Disposition CH (Material Stock)
/VSCEW/C_DISPOSITION_KB view_entity from Disposition KB (Stock)
/VSCEW/C_DISPOSITION_LK view_entity from Disposition LK
/VSCEW/C_DISPOSITION_LK_o view_entity from Disposition LK
A_MatlStkByKeyDteInAcctMod view from COMPOSITE API view by directly consuming I_MaterialStock
A_MatlStkInAcctMod view from COMPOSITE Material Stock
C_MaterialStockActual view_entity from CONSUMPTION Total actual stock quantity
C_MaterialStockByKeyDate view_entity from CONSUMPTION Material Stock at posting date
I_JITAvailableUnrstrcdStock view_entity from COMPOSITE Unrestricted stock for Material
I_MaterialUnrestrictedUseStock view from COMPOSITE Material Unrestricted Use Stock
I_MfgMaterialBatchStock view_entity from COMPOSITE Material Batch Stock Calculation
I_UnrestrictedUseStkOnPlntLvl view from COMPOSITE Unrestricted Use Stock on Plant Level
P_BatchMaterialStockValuation view_entity from COMPOSITE Latest Material Stock with Valuation - Aggregated
P_MaterialKPIStocksForPhysInv view_entity from COMPOSITE All Stocks with are used in Phys Inv
P_MatlStkAtKeyDateInAltUoM1 view_entity from COMPOSITE Stock at Key Date in Alternative UoM
P_MatStkQtyValByKeyDateBaseHdr view_entity from COMPOSITE SlowNonMovingMat: quant and val base
P_MatStkQtyValOVP1 view_entity from COMPOSITE Material Stock Quantiy and Value OVP1
P_MfgOrderItemCost view_entity inner COMPOSITE Manufacturing Order Item Amount
P_MfgProcgExecBatchStock view from COMPOSITE Batch Stock in Manufacturing Processing Execution
P_MfgProcgExecMaterialStock view from COMPOSITE Material Stock in Manufacturing Processing Execution
P_PhysInvtryProposal_L1 view_entity from COMPOSITE Inventory proposal level 1
P_PurgeStockCheck view_entity from COMPOSITE Stock check for purging
P_SrlNmbrStockDiffMatlStock view_entity from COMPOSITE Material Stock Quantity

Fields (21)

KeyField CDS FieldsUsed in Views
KEY Batch Batch 6
KEY Customer Customer,SoldToParty 3
KEY InventorySpecialStockType InventorySpecialStockType 8
KEY InventoryStockType InventoryStockType 3
KEY Material Material,Product 8
KEY MaterialBaseUnit MaterialBaseUnit,XXBaseUnit 7
KEY Plant Plant 9
KEY SDDocument SalesDocument,SalesOrder,SDDocument 3
KEY SDDocumentItem SalesDocumentItem,SalesOrderItem,SDDocumentItem 3
KEY SpecialStockIdfgStockOwner SpecialStockIdfgStockOwner 1
KEY StorageLocation StorageLocation 6
KEY Supplier Supplier 4
KEY WBSElementInternalID WBSElementInternalID 2
_Customer _Customer 1
_InventorySpecialStockType _InventorySpecialStockType 2
_Material _Material 4
_Plant _Plant 2
_StorageLocation _StorageLocation 2
_Supplier _Supplier 1
_UnitOfMeasure _UnitOfMeasure 1
CostEstimate CostEstimate 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_InvtryPrcByKeyDateUsdInLogs as _InventoryPriceByPeriodEndDate on  $projection.CostEstimate = _InventoryPriceByPeriodEndDate.CostEstimate 
  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,
      _SpclStkIdfgWBSElmntBasicData
}