@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_ALLOWED
@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
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CHEMICALMATERIAL",
"I_CHEMICALREVISION",
"I_EHSLOCATIONREVISION",
"I_EHSLOCATIONSTORAGELOCATION",
"I_HZDSSUBSTINVENTORYDRAFT",
"I_HZDSSUBSTINVTRYRLVTMVTTYPE",
"I_MATERIALDOCUMENTITEM_2",
"I_UNITOFMEASURE"
],
"ASSOCIATED":
[
"I_UNITOFMEASURE"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/