P_PhysInvtryDocItemPerYear

DDL: P_PHYSINVTRYDOCITEMPERYEAR Type: view_entity COMPOSITE Package: ODATA_MM_IM_PI_MASS_CREATE

PI Difference per year

P_PhysInvtryDocItemPerYear is a Composite CDS View that provides data about "PI Difference per year" in SAP S/4HANA. It reads from 1 data source (P_MappedPhysInvtryItem) and exposes 16 fields. Part of development package ODATA_MM_IM_PI_MASS_CREATE.

Data Sources (1)

SourceAliasJoin Type
P_MappedPhysInvtryItem P_MappedPhysInvtryItem from

Parameters (1)

NameTypeDefault
P_StartDate vdm_v_start_date

Annotations (3)

NameValueLevelField
AccessControl.authorizationCheck #NOT_ALLOWED view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (16)

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
Currency Currency
MaterialBaseUnit MaterialBaseUnit
PInvDiffQtyPerYearInBaseUnit
NumberOfPInvAdjustmentsPerYear
@AccessControl.authorizationCheck: #NOT_ALLOWED
@VDM.private: true
@VDM.viewType: #COMPOSITE
define view entity 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,
  Currency,
  MaterialBaseUnit,
  
  @Semantics.amount.currencyCode:'Currency'
  sum( 
    case
      when Quantity > BookQtyBfrCountInMatlBaseUnit then DifferenceAmountInCoCodeCrcy
      else -DifferenceAmountInCoCodeCrcy
    end 
  ) as DifferenceAmtPerYrInCoCodeCrcy,
  
  @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
  sum( DifferenceQuantityInBaseUnit ) as PInvDiffQtyPerYearInBaseUnit,
  
  count(*) as NumberOfPInvAdjustmentsPerYear //count(PhysicalInventoryLastCountDate)

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