@ClientHandling.algorithm: #SESSION_VARIABLE//Inserted by VDM CDS Suite Plugin
@ObjectModel.usageType.dataClass: #MIXED@ObjectModel.usageType.serviceQuality: #B@ObjectModel.usageType.sizeCategory: #L//Inserted by VDM CDS Suite Plugin
@AbapCatalog.sqlViewName: 'PMSPWSELLABLPROD'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #CHECK@VDM.private: true@VDM.viewType: #BASIC//Remark: Planned to be made reusable as I_SellableProductsInRtlStore (see GTNC)
defineview P_MSPWSellableProduct
asselectfrom I_ProductPlant
innerjoin I_Site on I_ProductPlant.Plant = I_Site.Site
association [0..1] to I_ProductSalesDeliveryPOS as _ProductPosControlSalesOrg on _ProductPosControlSalesOrg.Product = I_ProductPlant.Product
and _ProductPosControlSalesOrg.ProductSalesOrg = I_Site.SalesOrganization
and _ProductPosControlSalesOrg.ProductDistributionChnl = I_Site.DistributionChannel
and _ProductPosControlSalesOrg.Plant = ''
association [0..1] to I_ProductSalesDeliveryPOS as _ProductPosControlStore on _ProductPosControlStore.Product = I_ProductPlant.Product
and _ProductPosControlStore.ProductSalesOrg = I_Site.SalesOrganization
and _ProductPosControlStore.ProductDistributionChnl = I_Site.DistributionChannel
and _ProductPosControlStore.Plant = I_Site.Site
{
key I_ProductPlant.Plant as Store,
key I_ProductPlant.Product
}
// Select only stores
where
I_Site.SiteCategory = 'A'
and(
(
// Allow entry when PosControl for Store exists.
_ProductPosControlStore.Product isnotnulland(
_ProductPosControlStore.StoreSaleStartDate <= $session.system_date
and _ProductPosControlStore.StoreSaleEndDate >= $session.system_date
)
)
or(
// If ProductPosControlStore does not exist, then use the sales org specific ruleset
_ProductPosControlSalesOrg.Product isnotnulland _ProductPosControlStore.Product isnulland(
_ProductPosControlSalesOrg.StoreSaleStartDate <= $session.system_date
and _ProductPosControlSalesOrg.StoreSaleEndDate >= $session.system_date
)
)
)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_PRODUCTPLANT",
"I_PRODUCTSALESDELIVERYPOS",
"I_SITE"
],
"ASSOCIATED":
[
"I_PRODUCTSALESDELIVERYPOS"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/