C_PhysInvtryProposal

DDL: C_PHYSINVTRYPROPOSAL SQL: CPIPROPOSAL Type: view CONSUMPTION

Proposals for new PI counts

C_PhysInvtryProposal is a Consumption CDS View that provides data about "Proposals for new PI counts" in SAP S/4HANA. It reads from 2 data sources (I_Plant, P_EnhPhysInvtryActvStkSepVal) and exposes 64 fields with key fields Plant, StorageLocation, Material, Batch, ValuationType. It has 22 associations to related views.

Data Sources (2)

SourceAliasJoin Type
I_Plant I_Plant inner
P_EnhPhysInvtryActvStkSepVal sep from

Associations (22)

CardinalityTargetAliasCondition
[0..1] I_Plant _Plant $projection.Plant = _Plant.Plant
[0..1] I_StorageLocation _StorageLocation $projection.Plant = _StorageLocation.Plant and $projection.StorageLocation = _StorageLocation.StorageLocation
[0..1] I_Material _Material $projection.Material = _Material.Material
[0..1] I_Product _Product $projection.Material = _Product.Product
[0..1] I_Producttype _ProductType $projection.ProductType = _ProductType.ProductType
[0..1] I_ProductGroup _ProductGroup $projection.ProductGroup = _ProductGroup.MaterialGroup
[0..1] I_ProductStorageLocation _ProductStorageLocation $projection.Material = _ProductStorageLocation.Product and $projection.Plant = _ProductStorageLocation.Plant and $projection.StorageLocation = _ProductStorageLocation.StorageLocation
[0..1] I_Supplier _Supplier $projection.Supplier = _Supplier.Supplier
[1..1] I_SupplierCompanyByPlant _SupplierCompanyByPlant $projection.Supplier = _SupplierCompanyByPlant.Supplier and $projection.Plant = _SupplierCompanyByPlant.Plant
[0..1] I_Customer _Customer $projection.Customer = _Customer.Customer
[1..1] I_CustomerCompanyByPlant _CustomerCompanyByPlant $projection.Customer = _CustomerCompanyByPlant.Customer and $projection.Plant = _CustomerCompanyByPlant.Plant
[0..1] I_InventoryStockType _InventoryStockType $projection.InventoryStockType = _InventoryStockType.InventoryStockType
[0..1] I_PhysInvtrySpecialStockTypeVH _PhysInvtrySpecialStockTypeVH $projection.InventorySpecialStockType = _PhysInvtrySpecialStockTypeVH.InventorySpecialStockType
[0..1] I_SalesOrder _SalesOrder $projection.SalesOrder = _SalesOrder.SalesOrder
[0..1] I_UnitOfMeasure _MaterialBaseUnit $projection.MaterialBaseUnit = _MaterialBaseUnit.UnitOfMeasure
[0..1] I_Currency _Currency $projection.CompanyCodeCurrency = _Currency.Currency
[0..1] I_WBSElementByInternalKey _WBSElement $projection.WBSElementInternalID = _WBSElement.WBSElementInternalID
[0..1] I_CurrentMatlValnPrice _Price _Price.Material = $projection.Material and I_Plant.ValuationArea = _Price.ValuationArea and sep.InventoryValuationType = _Price.InventoryValuationType and sep.InventorySpecialStockTypeVal = _Price.InvtryValnSpecialStockType and sep.SalesOrderVal = _Price.SalesOrder and sep.SalesOrderItemVal = _Price.SalesOrderItem and sep.WBSElementInternalIDVal = _Price.WBSElementInternalID and sep.Supplier = '' and _Price.CurrencyRole = '10' and -- _Price.PeriodType = 'LF' and ( sep.InventorySpecialStockType = '' or sep.InventorySpecialStockType = 'V' or sep.InventorySpecialStockType = 'W' or sep.InventorySpecialStockType = 'O' or sep.InventorySpecialStockValnType <> '' ) and _Price.LedgerValnCrcyRoleIsUsedInLogs = 'X'
[0..1] I_CycleCountingSettings _CycleCounting _CycleCounting.CycleCountType = $projection.CycleCountType and _CycleCounting.Plant = $projection.Plant
[1..1] I_Product _ProductExt $projection.Material = _ProductExt.Product
[1..1] I_ProductPlant _ProductPlant $projection.Material = _ProductPlant.Product and $projection.Plant = _ProductPlant.Plant
[1..1] I_Batch _Batch $projection.Material = _Batch.Material and $projection.Plant = _Batch.Plant and $projection.Batch = _Batch.Batch

Annotations (15)

NameValueLevelField
AbapCatalog.preserveKey true view
AbapCatalog.sqlViewName CPIPROPOSAL view
EndUserText.label Proposals for new PI counts view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.createEnabled false view
ObjectModel.updateEnabled false view
ObjectModel.deleteEnabled false view
VDM.private false view
VDM.viewType #CONSUMPTION view
Search.searchable true view

Fields (64)

KeyFieldSource TableSource FieldDescription
KEY Plant P_EnhPhysInvtryActvStkSepVal Plant
KEY StorageLocation StorageLocation
KEY Material Material
KEY Batch RealProductBatch
KEY ValuationType
KEY Supplier Supplier
KEY SalesOrder SalesOrder
KEY SalesOrderItem SalesOrderItem
KEY WBSElement WBSElement
KEY Customer Customer
KEY StockOwner StockOwner
KEY InventoryStockType InventoryStockType
KEY InventorySpecialStockType InventorySpecialStockType
KEY MaterialIsPostedToStock P_EnhPhysInvtryActvStkSepVal MaterialIsPostedToStock
SearchForBatch Batch
SearchForValuationType SearchForValuationType
MaterialBaseUnit MaterialBaseUnit
CycleCountType CycleCountType
NmbrOfPhysInvtryPerFiscalYear NmbrOfPhysInvtryPerFiscalYear
PhysInvtryIntvlForCycCounting PhysInvtryIntvlForCycCounting
PhysInvtryFloatTimeCycCounting PhysInvtryFloatTimeCycCounting
WBSElementInternalID P_EnhPhysInvtryActvStkSepVal WBSElementInternalID
WBSDescription _WBSElement WBSDescription
ProductType ProductType Material Type
ProductGroup ProductGroup Material Group
SerialIdentifierAssgmtProfile _ProductPlant SerialNumberProfile
WarehouseStorageBin _ProductStorageLocation WarehouseStorageBin
IsMarkedForDeletion _Product IsMarkedForDeletion
MatlWrhsStkQtyInMatlBaseUnit
InventoryPrice
MaterialPriceUnitQty _Price MaterialPriceUnitQty
CompanyCodeCurrency P_EnhPhysInvtryActvStkSepVal CompanyCodeCurrency
NumberOfPhysInventoryCounts P_EnhPhysInvtryActvStkSepVal NumberOfPhysInventoryCounts
NumberOfPInvAdjustmentsPerYear P_EnhPhysInvtryActvStkSepVal NumberOfPInvAdjustmentsPerYear
PInvDiffQtyPerYearInBaseUnit P_EnhPhysInvtryActvStkSepVal PInvDiffQtyPerYearInBaseUnit
PhysicalInventoryLastCountDate P_EnhPhysInvtryActvStkSepVal PhysicalInventoryLastCountDate
NmbrOfDaysSinceLastPInvCount P_EnhPhysInvtryActvStkSepVal NmbrOfDaysSinceLastPInvCount
PhysicalInventoryItemIsCounted P_EnhPhysInvtryActvStkSepVal PhysicalInventoryItemIsCounted
NrOfGdsRcptSinceLastPInvCount P_EnhPhysInvtryActvStkSepVal NrOfGdsRcptSinceLastPInvCount
GdsRcptQtySinceLastCtInBsUnt P_EnhPhysInvtryActvStkSepVal GdsRcptQtySinceLastCtInBsUnt Received Quantity Since Last Count
AvgStkQtySinceLastCountInBsUnt
NrOfGoodsIssSinceLastPInvCount P_EnhPhysInvtryActvStkSepVal NrOfGoodsIssSinceLastPInvCount
GdsIssQtySinceLastCountInBsUnt P_EnhPhysInvtryActvStkSepVal GdsIssQtySinceLastCountInBsUnt Issued Quantity Since Last Count
UnitOfMeasure
_Plant _Plant
_StorageLocation _StorageLocation
_Supplier _Supplier
_Material _Material
_SupplierCompanyByPlant _SupplierCompanyByPlant
_Customer _Customer
_CustomerCompanyByPlant _CustomerCompanyByPlant
_PhysInvtrySpecialStockTypeVH _PhysInvtrySpecialStockTypeVH
_SalesOrder _SalesOrder
_MaterialBaseUnit _MaterialBaseUnit
_Currency _Currency
_WBSElement _WBSElement
_Product _Product
_ProductType _ProductType
_ProductGroup _ProductGroup
_InventoryStockType _InventoryStockType
_CycleCounting _CycleCounting
_ProductExt _ProductExt
_ProductPlant _ProductPlant
_Batch _Batch
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'CPIPROPOSAL'
@EndUserText.label: 'Proposals for new PI counts'

@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.createEnabled: false
@ObjectModel.updateEnabled: false
@ObjectModel.deleteEnabled: false


@VDM.private: false
@VDM.viewType: #CONSUMPTION
@Search.searchable: true

@ObjectModel: {
    semanticKey: ['Material', 'Plant', 'StorageLocation']
}

define view C_PhysInvtryProposal
  as select from P_EnhPhysInvtryActvStkSepVal as sep

    inner join   I_Plant on sep.Plant = I_Plant.Plant

  association [0..1] to I_Plant                        as _Plant                        on  $projection.Plant = _Plant.Plant

  association [0..1] to I_StorageLocation              as _StorageLocation              on  $projection.Plant           = _StorageLocation.Plant
                                                                                        and $projection.StorageLocation = _StorageLocation.StorageLocation

  association [0..1] to I_Material                     as _Material                     on  $projection.Material = _Material.Material

  association [0..1] to I_Product                      as _Product                      on  $projection.Material = _Product.Product

  association [0..1] to I_Producttype                  as _ProductType                  on  $projection.ProductType = _ProductType.ProductType

  association [0..1] to I_ProductGroup                 as _ProductGroup                 on  $projection.ProductGroup = _ProductGroup.MaterialGroup

  association [0..1] to I_ProductStorageLocation       as _ProductStorageLocation       on  $projection.Material        = _ProductStorageLocation.Product
                                                                                        and $projection.Plant           = _ProductStorageLocation.Plant
                                                                                        and $projection.StorageLocation = _ProductStorageLocation.StorageLocation

  association [0..1] to I_Supplier                     as _Supplier                     on  $projection.Supplier = _Supplier.Supplier

  association [1..1] to I_SupplierCompanyByPlant       as _SupplierCompanyByPlant       on  $projection.Supplier = _SupplierCompanyByPlant.Supplier
                                                                                        and $projection.Plant    = _SupplierCompanyByPlant.Plant

  association [0..1] to I_Customer                     as _Customer                     on  $projection.Customer = _Customer.Customer

  association [1..1] to I_CustomerCompanyByPlant       as _CustomerCompanyByPlant       on  $projection.Customer = _CustomerCompanyByPlant.Customer
                                                                                        and $projection.Plant    = _CustomerCompanyByPlant.Plant

  association [0..1] to I_InventoryStockType           as _InventoryStockType           on  $projection.InventoryStockType = _InventoryStockType.InventoryStockType

  association [0..1] to I_PhysInvtrySpecialStockTypeVH as _PhysInvtrySpecialStockTypeVH on  $projection.InventorySpecialStockType = _PhysInvtrySpecialStockTypeVH.InventorySpecialStockType

  association [0..1] to I_SalesOrder                   as _SalesOrder                   on  $projection.SalesOrder = _SalesOrder.SalesOrder

  association [0..1] to I_UnitOfMeasure                as _MaterialBaseUnit             on  $projection.MaterialBaseUnit = _MaterialBaseUnit.UnitOfMeasure

  association [0..1] to I_Currency                     as _Currency                     on  $projection.CompanyCodeCurrency = _Currency.Currency

  association [0..1] to I_WBSElementByInternalKey      as _WBSElement                   on  $projection.WBSElementInternalID = _WBSElement.WBSElementInternalID

  association [0..1] to I_CurrentMatlValnPrice         as _Price                        on  _Price.Material                       = $projection.Material
                                                                                        and I_Plant.ValuationArea                 =  _Price.ValuationArea
                                                                                        and sep.InventoryValuationType            =  _Price.InventoryValuationType
                                                                                        and sep.InventorySpecialStockTypeVal      =  _Price.InvtryValnSpecialStockType
                                                                                        and sep.SalesOrderVal                     =  _Price.SalesOrder
                                                                                        and sep.SalesOrderItemVal                 =  _Price.SalesOrderItem
                                                                                        and sep.WBSElementInternalIDVal           =  _Price.WBSElementInternalID
                                                                                        and sep.Supplier                          =  ''
                                                                                        and //if consider xobew, sep.SupplierVal = _Price.Supplier

                                                                                            _Price.CurrencyRole                   =  '10'
                                                                                        and //Company Code Currency

                                                                                            -- _Price.PeriodType = 'LF'   and    //Current Period

                                                                                            (
    sep.InventorySpecialStockType                                                                                                 =  ''
    or sep.InventorySpecialStockType                                                                                              =  'V'
    or sep.InventorySpecialStockType                                                                                              =  'W'
    or sep.InventorySpecialStockType                                                                                              =  'O'
    or //if consider xobew, sep.InventorySpecialStockTypeVal = 'O'

    sep.InventorySpecialStockValnType                                                                                             <> ''
  )
                                                                                        and _Price.LedgerValnCrcyRoleIsUsedInLogs =  'X'


  association [0..1] to I_CycleCountingSettings        as _CycleCounting                on  _CycleCounting.CycleCountType = $projection.CycleCountType
                                                                                        and _CycleCounting.Plant          = $projection.Plant

  // Datasource extensibility

  association [1..1] to I_Product                      as _ProductExt                   on  $projection.Material = _ProductExt.Product
  association [1..1] to I_ProductPlant                 as _ProductPlant                 on  $projection.Material = _ProductPlant.Product
                                                                                        and $projection.Plant    = _ProductPlant.Plant
  association [1..1] to I_Batch                        as _Batch                        on  $projection.Material = _Batch.Material
                                                                                        and $projection.Plant    = _Batch.Plant
                                                                                        and $projection.Batch    = _Batch.Batch


{

      @UI: { selectionField: { position: 10 },
             lineItem:       { position: 20,
                               importance: #HIGH },
             fieldGroup:     { qualifier: 'Header', position: 20 } }
      @ObjectModel: { foreignKey: { association: '_Plant' } }
      @Consumption: { semanticObject: 'Plant',
                      valueHelp: '_Plant' }
      @Search.defaultSearchElement: true
  key sep.Plant,

      @UI: { selectionField: { position: 20 },
             lineItem:       { position: 30,
                               importance: #HIGH },
             fieldGroup:     { qualifier: 'Header', position: 30} }
      @ObjectModel: { foreignKey: { association: '_StorageLocation' },
                      enabled: 'undefined' }
      @Consumption: { semanticObject: 'StorageLocation',
                      valueHelp: '_StorageLocation' }
      @Search.defaultSearchElement: true
  key StorageLocation,

      @UI: { lineItem: { position: 10,
                         importance: #HIGH },
             textArrangement: #TEXT_FIRST }
      @ObjectModel: { foreignKey: { association: '_Product' } }
      @Consumption: { semanticObject: 'Material',
                      valueHelpDefinition: [
                              { entity:  { name:    'I_ProductVH',
                                           element: 'Product' }
                              }] }
      @Search.defaultSearchElement: true
  key Material,

      @ObjectModel: { enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' }
                     } 

      @Consumption: { semanticObject: 'Batch',
                  valueHelpDefinition: [   { entity:  { name:    'I_BatchWithValuationVH',
                                                        element: 'Batch' },
                                             additionalBinding: [  { localElement: 'Plant',                     element: 'Plant' },
                                                                   { localElement: 'Material',                  element: 'Material' }, 
                                                                   { localElement: 'ValuationType',             element: 'ValuationType' } ],
                                             label: 'Batch (General)',
                                             qualifier: 'Secondary Value Help' },
                                           { entity:  { name:    'I_PhysInvtryBatchVH',
                                                        element: 'Batch' },
                                             additionalBinding: [  { localElement: 'Plant',            element: 'Plant' },
                                                                   { localElement: 'StorageLocation',  element: 'StorageLocation' },
                                                                   { localElement: 'Material',         element: 'Material' },
                                                                   { localElement: 'ValuationType',    element: 'InventoryValuationType' }  ],           
                                             label: 'Batch by Plant and Material' }             
                                       ] }                    

  key RealProductBatch as Batch,
  
      @ObjectModel: { enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' }
                    } 
                    
      @Consumption: { valueHelpDefinition: [   { entity:  { name:    'I_PhysInvtryMatValnTypeVH',
                                                        element: 'InventoryValuationType' },
                                             additionalBinding: [  { localElement: 'Plant',                     element: 'Plant' },
                                                                   { localElement: 'Material',                  element: 'Material' } ],
                                             label: 'Valuation Type' }                                                   
                                       ] }        
                       
  key cast(InventoryValuationType as bwtar_d) as ValuationType,   

      @ObjectModel: { foreignKey.association: '_Supplier',
                      enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' }
                     }
      @Consumption: { semanticObject: 'Supplier',
                      valueHelpDefinition: [
                            { entity:  { name:    'I_Supplier_VH',
                                         element: 'Supplier' }
                            }] }
      @Search.defaultSearchElement: true 
  key Supplier,

      @ObjectModel: { foreignKey: { association: '_SalesOrder' },
                      enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' }
                       }
      @Consumption: { semanticObject: 'SalesOrder',
                      valueHelpDefinition: [
                          { entity:  { name:    'I_SalesOrderStdVH',
                                       element: 'SalesOrder' }
                          }] }
      @Search.defaultSearchElement: true
  key SalesOrder,

      @ObjectModel: { enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' }
                     } 
  key SalesOrderItem,

      @ObjectModel: { enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' }
                     } 
      @Consumption: { valueHelpDefinition: [
                            { entity:  { name:    'I_WBSElementStdVH',
                                         element: 'WBSElement' }
                            }] }
      @ObjectModel.text.element:  [ 'WBSDescription' ]
  key WBSElement,

      @Consumption: { semanticObject: 'Customer',
                      valueHelpDefinition: [
                            { entity:  { name:    'I_Customer_VH',
                                         element: 'Customer' }
                            }] }
      @ObjectModel: { enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' } 
                     } 
      @Search.defaultSearchElement: true
  key Customer,

      @Consumption: { semanticObject: 'Customer',
                      valueHelpDefinition: [
                            { entity:  { name:    'I_Customer_VH',
                                         element: 'Customer' }
                            }] }
      @ObjectModel: { enabled: 'undefined',
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' }
                     } 
      @Search.defaultSearchElement: true
  key StockOwner,

      @ObjectModel: { foreignKey.association: '_InventoryStockType' }
      @UI.textArrangement: #TEXT_ONLY
      @UI: { fieldGroup:     { qualifier: 'Header', position: 40 } }
  key InventoryStockType,

      @UI: { fieldGroup:     { qualifier: 'Header', position: 50 },
             textArrangement: #TEXT_FIRST }
      @ObjectModel: { enabled: 'undefined',
                      foreignKey: { association: '_PhysInvtrySpecialStockTypeVH' },
                      filter: { transformedBy: 'CL_MM_IM_PHYS_INV_FILTER_EXIT' } }
  key InventorySpecialStockType,

      @Consumption: {valueHelpDefinition: [  { entity:  { name: 'I_MaterialIsPostedToStock', element : 'MaterialIsPostedToStock' } }] }
      @Consumption.filter: { selectionType     : #SINGLE,
                             multipleSelections: false,
                             mandatory         : true,
                             defaultValue      : 'X'  }
      @Environment.sql.passValue: true
      @Semantics.booleanIndicator: true
      @UI.dataPoint.title: 'Posted to stock'
  key sep.MaterialIsPostedToStock, 
     
// The field SearchForBatch is added to support the Fuzzy Search. The origin field Batch is

// cleared for non batch managed materials which are split valuated. The case statement to clear the batch

// is implemented in view P_EnhPhysInvtryActvStkSepVal using the field RealProductBatch.   

// Using a case statement or instead an union to replace the case then is not possible to realize the

// Fuzzy Search because of dumpts that the feature is not supported by the database.

      @Search: { defaultSearchElement: true, 
                 fuzzinessThreshold: 0.8 }
      @UI.hidden: true
      Batch as SearchForBatch,
      @Search: { defaultSearchElement: true, 
                 fuzzinessThreshold: 0.8 }
      @UI.hidden: true
      SearchForValuationType,

      @Semantics.unitOfMeasure: true
      //  @Consumption.valueHelp: '_MaterialBaseUnit'

      @Consumption.valueHelpDefinition: [
                            { entity:  { name:    'I_UnitOfMeasureStdVH',
                                         element: 'UnitOfMeasure' }
                            } ]
      MaterialBaseUnit, //2928780


      @Consumption: { valueHelpDefinition: [
                            { entity:  { name:    'I_CycleCountingSettings',
                                         element: 'CycleCountType' },
                              additionalBinding: [
                                       { localElement: 'Plant',
                                         element: 'Plant' } ]
                            }
                       ] }
      @UI: { fieldGroup: { qualifier: 'CycleCountingFacet',
                    position: 10,
                    importance: #HIGH } }
      @ObjectModel: { foreignKey: { association: '_CycleCounting' },
                      enabled: 'undefined' } // creates a Field Control Propertie in SEGW

      CycleCountType,

      @UI: { fieldGroup: { qualifier: 'CycleCountingFacet',
                    position: 20,
                    importance: #HIGH } }
      @Consumption.filter.hidden
      @ObjectModel: { enabled: 'undefined' } // creates a Field Control Propertie in SEGW

      NmbrOfPhysInvtryPerFiscalYear,

      @UI: { fieldGroup: { qualifier: 'CycleCountingFacet',
                    position: 30,
                    importance: #HIGH } }
      @Consumption.filter.hidden
      @ObjectModel: { enabled: 'undefined' } // creates a Field Control Propertie in SEGW

      @Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
      PhysInvtryIntvlForCycCounting,

      @UI: { fieldGroup: { qualifier: 'CycleCountingFacet',
                    position: 40,
                    importance: #HIGH } }
      @Consumption.filter.hidden
      @ObjectModel: { enabled: 'undefined' } // creates a Field Control Propertie in SEGW

      @Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
      PhysInvtryFloatTimeCycCounting,


      @UI.hidden: true
      sep.WBSElementInternalID,

      @UI.hidden: true
      @Semantics: { text: true }
      _WBSElement.WBSDescription,
      //===============================================================================================

      // Fields from product master data

      //===============================================================================================

      @EndUserText.label: 'Material Type'
      @ObjectModel.foreignKey.association: '_ProductType'
      @UI.textArrangement: #TEXT_ONLY
      ProductType,

      @EndUserText.label: 'Material Group'
      @ObjectModel.foreignKey.association: '_ProductGroup'
      @UI.textArrangement: #TEXT_ONLY
      ProductGroup,

      @UI.textArrangement: #TEXT_ONLY
      @ObjectModel.enabled: 'undefined'
      _ProductPlant.SerialNumberProfile                                                                             as SerialIdentifierAssgmtProfile, //2974210


      @ObjectModel.enabled: 'undefined'
      _ProductStorageLocation.WarehouseStorageBin,

      @ObjectModel.enabled: 'undefined'
      @Consumption.filter.selectionType: #SINGLE
      _Product.IsMarkedForDeletion,

      //===============================================================================================

      // Quantities

      //===============================================================================================

      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @UI.fieldGroup: { qualifier: 'Book',
                        position: 30,
                        importance: #HIGH }
      cast(MatlWrhsStkQtyInMatlBaseUnit as pi_current_quantity)                                                     as MatlWrhsStkQtyInMatlBaseUnit,

      //===============================================================================================

      // Prices

      //===============================================================================================

      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      @ObjectModel.enabled: 'undefined'
      cast(_Price.InventoryPrice as pi_inventory_price preserving type)                                             as InventoryPrice,
      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @ObjectModel.enabled: 'undefined'
      _Price.MaterialPriceUnitQty,

      //===============================================================================================

      // Fields from plant/company master data

      //===============================================================================================

      @Consumption.valueHelp: '_Currency'
      sep.CompanyCodeCurrency,

      //===============================================================================================

      // Key Figures from PI (only looking at current fiscal year)

      //===============================================================================================

      sep.NumberOfPhysInventoryCounts,

      @UI: { fieldGroup: { qualifier: 'Adjustments',
                           position: 10 } }
      sep.NumberOfPInvAdjustmentsPerYear,
      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @UI: { fieldGroup: { qualifier: 'Adjustments',
                           position: 20 } }
      sep.PInvDiffQtyPerYearInBaseUnit,

      //===============================================================================================

      // Key Figures from PI (looking at complete history, not only at current fiscal year)

      //===============================================================================================

      @ObjectModel.enabled: 'undefined'
      sep.PhysicalInventoryLastCountDate,

      @UI.dataPoint.title: 'Days Since Last Count'
      @Consumption.filter.hidden
      sep.NmbrOfDaysSinceLastPInvCount,

      sep.PhysicalInventoryItemIsCounted,

      @UI: { fieldGroup: { qualifier: 'GoodsReceipts',
                           position: 10 } }
      @ObjectModel.enabled: 'undefined'
      sep.NrOfGdsRcptSinceLastPInvCount,
      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @UI: { fieldGroup: { qualifier: 'GoodsReceipts',
                           position: 20 } }
      @EndUserText.label: 'Received Quantity Since Last Count'
      @ObjectModel.enabled: 'undefined'
      sep.GdsRcptQtySinceLastCtInBsUnt                                                                              as GdsRcptQtySinceLastCtInBsUnt,

      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @UI: { fieldGroup: { qualifier: 'Book',
                           position: 10 } }
      @ObjectModel.enabled: 'undefined'
      //  cast(round(MatlWrhsStkQtyInMatlBaseUnit - sep.AvgStkQtySinceLastCountCorrect, 3) as pi_average_book_quantity) as AvgStkQtySinceLastCountInBsUnt,

      cast(round(MatlWrhsStkQtyInMatlBaseUnit - sep.AvgStkQtySinceLastCountCorrect, 3) as pi_average_book_quantity) as AvgStkQtySinceLastCountInBsUnt,

      @UI: { fieldGroup: { qualifier: 'GoodsIssues',
                            position: 30 } }
      @ObjectModel.enabled: 'undefined'
      cast(
        case
          when sep.PhysicalInventoryLastCountDate is null then 0
          when sep.GdsIssQtySinceLastCountInBsUnt = 0 or sep.GdsIssQtySinceLastCountInBsUnt is null then 0
          when MatlWrhsStkQtyInMatlBaseUnit < sep.AvgStkQtySinceLastCountCorrect then 0
          when MatlWrhsStkQtyInMatlBaseUnit = sep.AvgStkQtySinceLastCountCorrect  then dats_days_between(sep.PhysicalInventoryLastCountDate,sep.CurrentDate)
          else  division(sep.GdsIssQtySinceLastCountInBsUnt,  MatlWrhsStkQtyInMatlBaseUnit -  sep.AvgStkQtySinceLastCountCorrect ,1)
        end as pi_turnover_since_last_cnt)                                                                          as InvtryTurnoverSinceLastCnt,

      @UI: { fieldGroup: { qualifier: 'GoodsIssues',
                            position: 10 } }
      @ObjectModel.enabled: 'undefined'
      sep.NrOfGoodsIssSinceLastPInvCount,

      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @UI: { fieldGroup: { qualifier: 'GoodsIssues',
                            position: 20 } }
      @EndUserText.label: 'Issued Quantity Since Last Count'
      @ObjectModel.enabled: 'undefined'
      sep.GdsIssQtySinceLastCountInBsUnt                                                                            as GdsIssQtySinceLastCountInBsUnt,

      @Semantics.unitOfMeasure: true
      @UI.hidden: true
      cast( cast( '10' as char3) as msehi)                                                                          as UnitOfMeasure, //Days


      @Consumption.filter.hidden: true
      _Plant,

      @Consumption.filter.hidden: true
      _StorageLocation,

      @Consumption.filter.hidden: true
      _Supplier,

      @Consumption.filter.hidden: true
      _Material,

      @Consumption.filter.hidden: true
      _SupplierCompanyByPlant,

      @Consumption.filter.hidden: true
      _Customer,

      @Consumption.filter.hidden: true
      _CustomerCompanyByPlant,


      @Consumption.filter.hidden: true
      _PhysInvtrySpecialStockTypeVH,

      @Consumption.filter.hidden: true
      _SalesOrder,

      @Consumption.filter.hidden: true
      _MaterialBaseUnit,

      @Consumption.filter.hidden: true
      _Currency,

      @Consumption.filter.hidden: true
      _WBSElement,

      @Consumption.filter.hidden: true
      _Product,

      @Consumption.filter.hidden: true
      _ProductType,

      @Consumption.filter.hidden: true
      _ProductGroup,

      @Consumption.filter.hidden: true
      _InventoryStockType,

      @Consumption.filter.hidden: true
      _CycleCounting,

      // Datasource extensibility

      @Consumption.filter.hidden: true
      _ProductExt,
      @Consumption.filter.hidden: true
      _ProductPlant,
      @Consumption.filter.hidden: true
      _Batch

}

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CURRENTMATLVALNPRICE",
"I_PLANT",
"I_PRODUCT",
"I_PRODUCTPLANT",
"I_PRODUCTSTORAGELOCATION",
"I_WBSELEMENTBYINTERNALKEY",
"P_ENHPHYSINVTRYACTVSTKSEPVAL"
],
"ASSOCIATED":
[
"I_BATCH",
"I_CURRENCY",
"I_CURRENTMATLVALNPRICE",
"I_CUSTOMER",
"I_CUSTOMERCOMPANYBYPLANT",
"I_CYCLECOUNTINGSETTINGS",
"I_INVENTORYSTOCKTYPE",
"I_MATERIAL",
"I_PHYSINVTRYSPECIALSTOCKTYPEVH",
"I_PLANT",
"I_PRODUCT",
"I_PRODUCTGROUP",
"I_PRODUCTPLANT",
"I_PRODUCTSTORAGELOCATION",
"I_PRODUCTTYPE",
"I_SALESORDER",
"I_STORAGELOCATION",
"I_SUPPLIER",
"I_SUPPLIERCOMPANYBYPLANT",
"I_UNITOFMEASURE",
"I_WBSELEMENTBYINTERNALKEY"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/