I_HzdsSubstInvtryProdQty

DDL: I_HZDSSUBSTINVTRYPRODQTY Type: view COMPOSITE Package: EHHSS_BO_HSI

HSI: Product Quantitiy

I_HzdsSubstInvtryProdQty is a Composite CDS View that provides data about "HSI: Product Quantitiy" in SAP S/4HANA. It reads from 8 data sources and exposes 6 fields with key fields Material, EHSLocationUUID. It has 1 association to related views. Part of development package EHHSS_BO_HSI.

Data Sources (8)

SourceAliasJoin Type
I_UnitOfMeasure _BaseUnit inner
I_ChemicalMaterial _ChemicalMaterial inner
I_ChemicalRevision _ChemicalRevision inner
I_EHSLocationStorageLocation _EHSLocationSL inner
I_EHSLocationRevision _HSILocation inner
I_HzdsSubstInventoryDraft _HzdsSubstInventoryDraft inner
I_MaterialDocumentItem_2 _MaterialDocumentItem from
I_HzdsSubstInvtryRlvtMvtType _Movementtype inner

Parameters (2)

NameTypeDefault
P_StartDate budat
P_EndDate budat

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_UnitOfMeasure _UnitOfMeasure $projection.QuantityUnit = _UnitOfMeasure.UnitOfMeasure

Annotations (12)

NameValueLevelField
EndUserText.label HSI: Product Quantitiy view
AbapCatalog.sqlViewName IHASSINVTPPROQTY view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.personalData.blocking #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
AccessControl.authorizationCheck #NOT_REQUIRED view
DataAging.noAgingRestriction true view

Fields (6)

KeyFieldSource TableSource FieldDescription
KEY Material
KEY EHSLocationUUID I_EHSLocationRevision EHSLocationUUID
ChemicalUUID I_ChemicalMaterial ChemicalUUID
Quantity
QuantityUnit I_MaterialDocumentItem_2 MaterialBaseUnit
_UnitOfMeasure _UnitOfMeasure
@EndUserText.label: 'HSI: Product Quantitiy'

@AbapCatalog: { sqlViewName: 'IHASSINVTPPROQTY',
                compiler.compareFilter: true,
                preserveKey: true }
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.personalData.blocking: #NOT_REQUIRED  
@VDM.viewType: #COMPOSITE

@ObjectModel:
{
  usageType:
  {
    dataClass: #MIXED,
    sizeCategory: #XL,
    serviceQuality: #D
  }
}
                
@AccessControl.authorizationCheck: #NOT_REQUIRED
@DataAging.noAgingRestriction:true

define view I_HzdsSubstInvtryProdQty
    with parameters
      P_StartDate : budat,
      P_EndDate   : budat

  as select from I_MaterialDocumentItem_2      as _MaterialDocumentItem     // correction 3032388 24.03.2021


  inner join    I_ChemicalMaterial             as _ChemicalMaterial        on _ChemicalMaterial.Material              = _MaterialDocumentItem.Material  
 
  inner join    I_ChemicalRevision             as _ChemicalRevision        on _ChemicalMaterial.ChemicalRevisionUUID  = _ChemicalRevision.ChemicalRevisionUUID 
                                                                          and _ChemicalMaterial.ChemicalUUID          = _ChemicalRevision.ChemicalUUID     
                                        
  inner join    I_EHSLocationStorageLocation   as _EHSLocationSL           on _EHSLocationSL.StorageLocation          = _MaterialDocumentItem.StorageLocation
                                                                          and _EHSLocationSL.Plant                    = _MaterialDocumentItem.Plant   
 
  inner join    I_EHSLocationRevision          as _HSILocation             on _HSILocation.EHSLocationUUID            = _EHSLocationSL.EHSLocationUUID
                                                                          and _HSILocation.EHSLocationRevisionUUID    = _EHSLocationSL.EHSLocationRevisionUUID
 
  inner join    I_HzdsSubstInvtryRlvtMvtType   as _Movementtype            on _Movementtype.Plant                     = _HSILocation.Plant              
                                                                          and _Movementtype.GoodsMovementType         = _MaterialDocumentItem.GoodsMovementType   
                                                                          
  inner join    I_HzdsSubstInventoryDraft      as _HzdsSubstInventoryDraft on _HzdsSubstInventoryDraft.EHSLocationUUID = _EHSLocationSL.EHSLocationUUID
  
  inner join    I_UnitOfMeasure                as _BaseUnit                on _MaterialDocumentItem.MaterialBaseUnit = _BaseUnit.UnitOfMeasure
  association [0..1] to I_UnitOfMeasure        as _UnitOfMeasure           on  $projection.QuantityUnit = _UnitOfMeasure.UnitOfMeasure
  
{

  key cast (_MaterialDocumentItem.Material as char40 preserving type ) as Material,
  key _HSILocation.EHSLocationUUID,
      _ChemicalMaterial.ChemicalUUID,
      
      @Semantics.quantity.unitOfMeasure: 'QuantityUnit'
//******** begin correction 3032388 15.03.2021

      sum( _MaterialDocumentItem.QuantityInBaseUnit )              as Quantity,
//      sum( 

//          case

//          when _MaterialDocumentItem.DebitCreditCode  = 'S' then QuantityInBaseUnit 

//          when _MaterialDocumentItem.DebitCreditCode = 'H' then QuantityInBaseUnit * -1

//          else QuantityInBaseUnit

//          end )

//          as Quantity,

//******** end correction 3032388 15.03.2021

      @Semantics.unitOfMeasure: true
      _MaterialDocumentItem.MaterialBaseUnit as QuantityUnit,
      _UnitOfMeasure
  

}
where _MaterialDocumentItem.PostingDate    >= $parameters.P_StartDate
  and _MaterialDocumentItem.PostingDate    <= $parameters.P_EndDate
  and _ChemicalRevision.RevisionStartDate <= $session.system_date
  and _ChemicalRevision.RevisionEndDate    >= $session.system_date
  and _HSILocation.RevisionStartDate       <= $session.system_date
  and _HSILocation.RevisionEndDate         >= $session.system_date
  and _MaterialDocumentItem.DebitCreditCode = 'H' // correction 3032388 15.03.2021

  
group by
  _MaterialDocumentItem.Material,
  _HSILocation.EHSLocationUUID,
  _ChemicalMaterial.ChemicalUUID,
  _MaterialDocumentItem.MaterialBaseUnit