P_PhysInvtryDocItemPerYear

DDL: P_PHYSINVTRYDOCITEMPERYEAR SQL: PPIDIFFPY Type: view COMPOSITE

P_PhysInvtryDocItemPerYear is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (P_MappedPhysInvtryItem) and exposes 14 fields.

Data Sources (1)

SourceAliasJoin Type
P_MappedPhysInvtryItem P_MappedPhysInvtryItem from

Parameters (1)

NameTypeDefault
P_StartDate vdm_v_start_date

Annotations (7)

NameValueLevelField
AbapCatalog.preserveKey true view
AbapCatalog.sqlViewName PPIDIFFPY view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_ALLOWED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (14)

KeyFieldSource TableSource FieldDescription
Material Material
Plant Plant
StorageLocation StorageLocation
Supplier Supplier
Customer Customer
Batch Batch
InventorySpecialStockType InventorySpecialStockType
InventoryStockType InventoryStockType
SalesOrder SalesOrder
SalesOrderItem SalesOrderItem
WBSElementInternalID WBSElementInternalID
StockOwner StockOwner
PInvDiffQtyPerYearInBaseUnit
NumberOfPInvAdjustmentsPerYear
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'PPIDIFFPY'

@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@ClientHandling.algorithm: #SESSION_VARIABLE

@VDM.private: true
@VDM.viewType: #COMPOSITE
define view P_PhysInvtryDocItemPerYear
  with parameters
    P_StartDate : vdm_v_start_date
 as select from P_MappedPhysInvtryItem
{
  Material,
  Plant,
  StorageLocation,
  Supplier,
  Customer,
  Batch,
  InventorySpecialStockType,  
  InventoryStockType,
  SalesOrder,
  SalesOrderItem,
  WBSElementInternalID,
  StockOwner,
  
  sum( 
    case
      when Quantity > BookQtyBfrCountInMatlBaseUnit then DifferenceAmountInCoCodeCrcy
      else -DifferenceAmountInCoCodeCrcy
    end 
  ) as DifferenceAmtPerYrInCoCodeCrcy,
  
  sum( DifferenceQuantityInBaseUnit ) as PInvDiffQtyPerYearInBaseUnit,
  
  count(*) as NumberOfPInvAdjustmentsPerYear //count(PhysicalInventoryLastCountDate)

}
where PhysInvtryDifferenceIsPosted = 'X'
  and PhysicalInventoryLastCountDate <= :P_StartDate
  and PhysicalInventoryLastCountDate > DATS_ADD_MONTHS(:P_StartDate, -12,'UNCHANGED')
  and DifferenceQuantityInBaseUnit <> 0
group by
  Material,
  Plant,
  StorageLocation,
  Supplier,
  Customer,
  Batch,
  InventorySpecialStockType,
  InventoryStockType,
  SalesOrder,
  SalesOrderItem,
  WBSElementInternalID,
 StockOwner
//  CurrentDate

  

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_MAPPEDPHYSINVTRYITEM"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/