@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName : 'PPIKEYFIGBASE'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@VDM.viewType: #COMPOSITE
define view P_PhysInvtryKeyFiguresBase as select from P_MappedPhysInvtryItem as item
inner join I_Plant as _Plant on item.Plant = _Plant.Plant
inner join P_PhysIntryValuationArea as _ValuationArea on _Plant.ValuationArea = _ValuationArea.ValuationArea
inner join I_CompanyCode as _CompanyCode on _CompanyCode.CompanyCode = _ValuationArea.CompanyCode
inner join marv as _CurrentPeriod on _CurrentPeriod.bukrs = _ValuationArea.CompanyCode
// association [0..1] to I_FiscalYear as _FiscalYear on _FiscalYear.FiscalYearVariant = _CompanyCode.FiscalYearVariant and
// _FiscalYear.FiscalYear = _CurrentPeriod.lfgja
{
key Material,
key item.Plant,
key StorageLocation,
key Batch,
key Supplier,
key SalesOrder,
key SalesOrderItem,
key WBSElementInternalID,
key Customer,
key StockOwner,
key InventoryStockType,
key InventorySpecialStockType,
key MaterialBaseUnit,
max(PhysicalInventoryLastCountDate) as PhysicalInventoryLastCountDate,
// use check of PI Doc fiscal year and MARV current fiscal year as I_FiscalYear has performance issues
//sum( case when _FiscalYear.FiscalYearStartDate > PhysicalInventoryLastCountDate then 0 else 1 end ) as NumberOfPhysInventoryCounts,
sum( case when ( _CurrentPeriod.lfgja = item.FiscalYear and item.PhysicalInventoryItemIsCounted = 'X' ) then 1 else 0 end ) as NumberOfPhysInventoryCounts,
$session.system_date as CurrentDate
}
where item.PhysInvtryDifferenceIsPosted = 'X'
group by
Material,
item.Plant,
StorageLocation,
Batch,
SalesOrder,
SalesOrderItem,
Supplier,
Customer,
StockOwner,
WBSElementInternalID,
InventoryStockType,
InventorySpecialStockType,
MaterialBaseUnit
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_COMPANYCODE",
"I_PLANT",
"P_MAPPEDPHYSINVTRYITEM",
"P_PHYSINTRYVALUATIONAREA",
"MARV"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload
P_PhysInvtryKeyFiguresBase view