P_AssgblStoreForProcmtProdExt

DDL: P_ASSGBLSTOREFORPROCMTPRODEXT SQL: PASNSTRPROCPRODE Type: view CONSUMPTION Package: RFM_ASSG_PROCMT_PROD

Assignable Store for Prod (Ext) Val Help

P_AssgblStoreForProcmtProdExt is a Consumption CDS View that provides data about "Assignable Store for Prod (Ext) Val Help" in SAP S/4HANA. It reads from 6 data sources and exposes 7 fields with key fields Product, Store. It has 1 association to related views. Part of development package RFM_ASSG_PROCMT_PROD.

Data Sources (6)

SourceAliasJoin Type
I_ProductPlant I_ProductPlant left_outer
I_LoglProdAssgmtSuplrToStore LoglProdAssgmtSuplrToStore left_outer
I_LoglProductAssgmtDCToStore LoglProductAssgmtDCToStore left_outer
P_StoreGrpFromClfnStore P_StoreGrpFromClfnStore left_outer
I_Plant Plant cross
I_ActiveLogisticalProduct Product from

Parameters (3)

NameTypeDefault
P_ValidityStartDate datum
P_ValidityEndDate datum
data logistical

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_ActiveLogisticalProduct _ActiveLogisticalProduct $projection.Product = _ActiveLogisticalProduct.Product

Annotations (8)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.sqlViewName PASNSTRPROCPRODE view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #PRIVILEGED_ONLY view
ObjectModel.usageType.serviceQuality #C view
VDM.viewType #CONSUMPTION view
VDM.private true view

Fields (7)

KeyFieldSource TableSource FieldDescription
KEY Product I_ActiveLogisticalProduct Product
KEY Store I_Plant Plant
StoreName I_Plant PlantName
CityName
StreetName
StoreGroupInternalID _AssgdStoreGroup StoreGroupInternalID
_ActiveLogisticalProduct _ActiveLogisticalProduct
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'PASNSTRPROCPRODE'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@ObjectModel.usageType.serviceQuality: #C
@VDM.viewType: #CONSUMPTION
@VDM.private: true

define view P_AssgblStoreForProcmtProdExt
  with parameters
    P_ValidityStartDate : datum,
    P_ValidityEndDate   : datum
  -- no checks for purchasing info records (especially no time-dependency thereof)
  -- no checks for EKOrgs
  -- no WRF3 checks
  -- Superset of data: logistical products in stores
  as select from    I_ActiveLogisticalProduct                               as Product
    cross join      I_Plant                                                 as Plant

  -- Condition: If a MARC entry already exists, the respective product must be defined as 'external procurement'
    left outer join I_ProductPlant                                                                        on  I_ProductPlant.Product = Product.Product
                                                                                                          and I_ProductPlant.Plant   = Plant.Plant
  -- Condition: No existing or overlaping assignments
    left outer join I_LoglProductAssgmtDCToStore                            as LoglProductAssgmtDCToStore on  Plant.Plant                                       = LoglProductAssgmtDCToStore.Store
                                                                                                          and Product.Product                                   = LoglProductAssgmtDCToStore.Material
    -- restrict time-dependent overlaps
                                                                                                          and (
                                                                                                             -- Start Date is within requested period
                                                                                                             (
                                                                                                               LoglProductAssgmtDCToStore.ValidityStartDate     >= $parameters.P_ValidityStartDate
                                                                                                               and LoglProductAssgmtDCToStore.ValidityStartDate <= $parameters.P_ValidityEndDate
                                                                                                             )
                                                                                                             or -- End Date is within requested period
                                                                                                             (
                                                                                                               LoglProductAssgmtDCToStore.ValidityEndDate       >= $parameters.P_ValidityStartDate
                                                                                                               and LoglProductAssgmtDCToStore.ValidityEndDate   <= $parameters.P_ValidityEndDate
                                                                                                             )
                                                                                                             or -- Start Date and End Date wrap requested period
                                                                                                             (
                                                                                                               LoglProductAssgmtDCToStore.ValidityStartDate     <= $parameters.P_ValidityStartDate
                                                                                                               and LoglProductAssgmtDCToStore.ValidityEndDate   >= $parameters.P_ValidityEndDate
                                                                                                             )
                                                                                                           )
    left outer join I_LoglProdAssgmtSuplrToStore                            as LoglProdAssgmtSuplrToStore on  Plant.Plant                                       = LoglProdAssgmtSuplrToStore.Store
                                                                                                          and Product.Product                                   = LoglProdAssgmtSuplrToStore.Material
    -- restrict time-dependent overlaps
                                                                                                          and (
                                                                                                             -- Start Date is within requested period
                                                                                                             (
                                                                                                               LoglProdAssgmtSuplrToStore.ValidityStartDate     >= $parameters.P_ValidityStartDate
                                                                                                               and LoglProdAssgmtSuplrToStore.ValidityStartDate <= $parameters.P_ValidityEndDate
                                                                                                             )
                                                                                                             or -- End Date is within requested period
                                                                                                             (
                                                                                                               LoglProdAssgmtSuplrToStore.ValidityEndDate       >= $parameters.P_ValidityStartDate
                                                                                                               and LoglProdAssgmtSuplrToStore.ValidityEndDate   <= $parameters.P_ValidityEndDate
                                                                                                             )
                                                                                                             or -- Start Date and End Date wrap requested period
                                                                                                             (
                                                                                                               LoglProdAssgmtSuplrToStore.ValidityStartDate     <= $parameters.P_ValidityStartDate
                                                                                                               and LoglProdAssgmtSuplrToStore.ValidityEndDate   >= $parameters.P_ValidityEndDate
                                                                                                             )
                                                                                                           )

    left outer join P_StoreGrpFromClfnStore( P_SAPClient : $session.client) as _AssgdStoreGroup           on Plant.Plant = _AssgdStoreGroup.Store

    association [1..1] to I_ActiveLogisticalProduct as _ActiveLogisticalProduct on $projection.Product = _ActiveLogisticalProduct.Product

{
  key Product.Product                                  as Product,
  key Plant.Plant                                      as Store,
      Plant.PlantName                                  as StoreName,
      Plant._Address.CityName,
      Plant._Address.StreetName,
      _AssgdStoreGroup.StoreGroupInternalID,

      /* Exposed associations */
      _ActiveLogisticalProduct
}
where
       Plant.PlantCategory                         = 'A' -- only store
  and  LoglProductAssgmtDCToStore.SourceListRecord is null -- no match in source list (anti-join), thus no time overlap with existing assignments
  and  LoglProdAssgmtSuplrToStore.SourceListRecord is null -- no match in source list (anti-join), thus no time overlap with existing assignments
  -- Source of Supply (MARC entry) optional, but if defined then external procurement
  and(
       I_ProductPlant.SourceOfSupplyCategory       is null
    or I_ProductPlant.SourceOfSupplyCategory       = '1'
    or I_ProductPlant.SourceOfSupplyCategory       = '3'
    or I_ProductPlant.SourceOfSupplyCategory       = '4'
    or I_ProductPlant.SourceOfSupplyCategory       = 'A'
    or I_ProductPlant.SourceOfSupplyCategory       = 'B'
    or I_ProductPlant.SourceOfSupplyCategory       = 'C'
    or I_ProductPlant.SourceOfSupplyCategory       = 'D'
    or I_ProductPlant.SourceOfSupplyCategory       = 'E'
    or I_ProductPlant.SourceOfSupplyCategory       = 'F'
    or I_ProductPlant.SourceOfSupplyCategory       = 'G'
    or I_ProductPlant.SourceOfSupplyCategory       = 'H'
    or I_ProductPlant.SourceOfSupplyCategory       = 'I'
  )