@AbapCatalog.sqlViewName: 'PMPEBATCHSTOCK'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #XXL, dataClass: #TRANSACTIONAL}
@VDM.viewType: #COMPOSITE
@VDM.private: true
define view P_MfgProcgExecBatchStock
as select from I_MaterialStock_2 as mat
inner join I_MatlPlntCompAssembleControl as marc on marc.Product = mat.Material
and marc.Plant = mat.Plant
and marc.IsBatchManagementRequired = 'X'
{
key mat.Material,
key mat.Plant,
key mat.StorageLocation,
key mat.Batch,
key mat.Supplier,
key mat.SDDocument as SalesDocument,
key mat.SDDocumentItem as SalesDocumentItem,
key mat.WBSElementInternalID,
key mat.Customer,
key mat.InventorySpecialStockType,
@Semantics.unitOfMeasure
key mat.MaterialBaseUnit,
@Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
@Aggregation.default: #SUM
sum(mat.MatlWrhsStkQtyInMatlBaseUnit) as VltdUnrestrictedUseStkQty,
mat._UnitOfMeasure,
mat._Material,
mat._Plant,
mat._StorageLocation,
mat._Supplier,
mat._Customer,
mat._InventorySpecialStockType
}
where
mat.InventoryStockType = '01' //only free available stock
group by
mat.Material,
mat.Plant,
mat.StorageLocation,
mat.Batch,
mat.Supplier,
mat.SDDocument,
mat.SDDocumentItem,
mat.WBSElementInternalID,
mat.Customer,
mat.InventorySpecialStockType,
mat.MaterialBaseUnit;
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MATERIALSTOCK_2",
"I_MATLPLNTCOMPASSEMBLECONTROL"
],
"ASSOCIATED":
[
"I_CUSTOMER",
"I_INVENTORYSPECIALSTOCKTYPE",
"I_PLANT",
"I_PRODUCT",
"I_STORAGELOCATION",
"I_SUPPLIER",
"I_UNITOFMEASURE"
],
"BASE":
[
"I_MATERIALSTOCK_2"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/