P_AssgblDCForSuplr is a Consumption CDS View in SAP S/4HANA. It reads from 3 data sources (I_Plant, I_ActiveLogisticalProduct, I_ProductPlant) and exposes 4 fields with key fields Material, DistributionCenter. It has 1 association to related views.
@ClientHandling.algorithm: #SESSION_VARIABLE@AbapCatalog.sqlViewName: 'PASNDCFORSUPL'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #PRIVILEGED_ONLY@ObjectModel.usageType.serviceQuality: #B@VDM.viewType: #CONSUMPTION@VDM.private: truedefineview P_AssgblDCForSuplr
withparameters
P_ValidityStartDate : datum,
P_ValidityEndDate : datum,
P_Supplier : lifnr
-- currently the parameters are not used for filtering purposes yet
-- no check for specific supplier
-- no checks for purchasing info records
-- no checks for EKOrgs
-- no WRF3 checks
-- no time-dependant checks (neither purchasing info record nor WRF3 or other time-dependant table)
asselectfrom I_ActiveLogisticalProduct as Product
crossjoin I_Plant as Plant
-- Condition: If a MARC entry already exists, the respective product must be defined as 'external procurement'
leftouterjoin I_ProductPlant as ProductPlant on Product.Product = ProductPlant.Product
and Plant.Plant = ProductPlant.Plant
association [1..1] to I_ActiveLogisticalProduct as _ActiveLogisticalProduct on $projection.Material = _ActiveLogisticalProduct.Product
{
@ObjectModel.foreignKey.association: '_ActiveLogisticalProduct'
key Product.Product as Material,
key Plant.Plant as DistributionCenter,
PlantName as DistributionCenterName,
/* Exposed associations */
_ActiveLogisticalProduct
}
where
Plant.PlantCategory = 'B' -- only DC
and
-- Source of Supply (MARC entry) optional, but if defined then external procurement
(
ProductPlant.SourceOfSupplyCategory isnull -- no entry found
or ProductPlant.SourceOfSupplyCategory = '1'
or ProductPlant.SourceOfSupplyCategory = '3'
or ProductPlant.SourceOfSupplyCategory = '4'
or ProductPlant.SourceOfSupplyCategory = 'A'
or ProductPlant.SourceOfSupplyCategory = 'B'
or ProductPlant.SourceOfSupplyCategory = 'C'
or ProductPlant.SourceOfSupplyCategory = 'D'
or ProductPlant.SourceOfSupplyCategory = 'E'
or ProductPlant.SourceOfSupplyCategory = 'F'
or ProductPlant.SourceOfSupplyCategory = 'G'
or ProductPlant.SourceOfSupplyCategory = 'H'
or ProductPlant.SourceOfSupplyCategory = 'I'
)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACTIVELOGISTICALPRODUCT",
"I_PLANT",
"I_PRODUCTPLANT"
],
"ASSOCIATED":
[
"I_ACTIVELOGISTICALPRODUCT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/