Skip to content

StockInHand

Source SQL File - Google Cloud Cortex Data Foundation

Google Cloud Cortex Foudantion - Cortex Reporting - (ecc) - StockInHand

Overview

This view provides a consolidated view of stock in hand for a given material and site, aggregating data from various sources such as distribution centers, vendor locations, customer locations, and special stock at vendors in consignment. It also transposes the MARD table to present different stock reasons in a single column.

Data Sources

Source Table/View Description
mard Material master data
mska Batch stock data
msfd Vendor consignment stock data
mslb Vendor consignment stock data for blocked stock
msku Customer consignment stock data
mkol Stock data for special stock types

Key Use Cases

  • Reporting on stock in hand for a given material and site
  • Analyzing stock levels by different stock reasons
  • Identifying stock discrepancies across different sources

Query Logic

The query combines data from multiple source tables using a UNION ALL operation. For each source table, it extracts relevant fields and applies a UNNEST operation to split the Qty field into two columns: Qty and StockType. The StockType column indicates the reason for the stock, such as unrestricted use, quality inspection, or blocked stock.

Possible relation with SAP Transactions

Transaction Code Transaction Description
MMBE Display Material Master
MB52 Stock Overview: Plant/Material
MB5B Stock Overview: Material Document

Data Lineage

Under Development

Table/View Fields

Field Field Description Description in SAP Dictionary (Comming soon)
Client_MANDT Client
ArticleNumber_MATNR Article Number
Site_WERKS Site
StorageLocation_LGORT Storage Location
BatchNumber_CHARG Batch Number
SpecialStockIndicator_SOBKZ Special Stock Indicator
SDDocumentNumber_VBELN SD Document Number
SDDocumentItemNumber_POSNR SD Document Item Number
VendorAccountNumber_LIFNR Vendor Account Number
CustomerNumber_KUNNR Customer Number
Qty Quantity
StockType Stock Type

Comments