C_SchedProdnSalesDocumentVH

DDL: C_SCHEDPRODNSALESDOCUMENTVH SQL: CSHEDPDSLSDOCVH Type: view CONSUMPTION Package: ODATA_PP_CAP_SCHEDPRODN

Sales Document

C_SchedProdnSalesDocumentVH is a Consumption CDS View that provides data about "Sales Document" in SAP S/4HANA. It reads from 11 data sources and exposes 9 fields with key fields SalesOrder, SalesOrderItem, SalesOrderItem. Part of development package ODATA_PP_CAP_SCHEDPRODN.

Data Sources (11)

SourceAliasJoin Type
I_BillOfOperationsType _BillOfOperationsType inner
I_BillOfOperationsType _BillOfOperationsType inner
I_OrderItem _Ordermainitem inner
I_SchedProdnProductionVersion _ProductionVersion inner
I_SchedProdnProductionVersion _ProductionVersion inner
I_ProductPlant _ProductPlant inner
I_ProductPlant _ProductPlant inner
vbap _vbap inner
vbap _vbap inner
I_WorkCenter _WorkCenter inner
I_WorkCenter _WorkCenter inner

Annotations (15)

NameValueLevelField
AbapCatalog.sqlViewName CSHEDPDSLSDOCVH view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #MANDATORY view
EndUserText.label Sales Document view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.dataCategory #VALUE_HELP view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MASTER view
ObjectModel.representativeKey SalesOrder view
VDM.viewType #CONSUMPTION view
Search.searchable true view
Consumption.ranked true view
Metadata.ignorePropagatedAnnotations true view

Fields (9)

KeyFieldSource TableSource FieldDescription
KEY SalesOrder _LogisticsOrder SalesOrder
KEY SalesOrderItem _LogisticsOrder SalesOrderItem
SalesDocumentItemText vbap arktx
MRPController _LogisticsOrder MRPController
SalesOrderasSalesOrder
KEY SalesOrderItem _PlannedOrder SalesOrderItem
SalesDocumentItemText vbap arktx
MRPController _PlannedOrder MRPController
Plant _PlannedOrder MRPPlant
@AbapCatalog.sqlViewName: 'CSHEDPDSLSDOCVH'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #MANDATORY
@EndUserText.label: 'Sales Document'
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.dataCategory: #VALUE_HELP
@ObjectModel.usageType: {serviceQuality: #D, sizeCategory: #XL, dataClass: #MASTER}
@ObjectModel.representativeKey: 'SalesOrder'
@VDM.viewType: #CONSUMPTION
@Search.searchable: true
@Consumption.ranked: true
@Metadata.ignorePropagatedAnnotations: true
define view C_SchedProdnSalesDocumentVH
  as select distinct from  I_LogisticsOrder              as _LogisticsOrder

    inner join             I_OrderItem                   as _Ordermainitem        on  _LogisticsOrder.OrderID  = _Ordermainitem.OrderID
                                                                                  and _Ordermainitem.OrderItem = '0001'

    inner join             I_SchedProdnProductionVersion as _ProductionVersion    on  _Ordermainitem.Material          = _ProductionVersion.Material
                                                                                  and _Ordermainitem.ProductionPlant   = _ProductionVersion.Plant
                                                                                  and _Ordermainitem.ProductionVersion = _ProductionVersion.ProductionVersion

    inner join             I_BillOfOperationsType        as _BillOfOperationsType on _ProductionVersion.BillOfOperationsType = _BillOfOperationsType.BillOfOperationsType

    inner join             I_WorkCenter                  as _WorkCenter           on  _ProductionVersion.ProductionLine = _WorkCenter.WorkCenter
                                                                                  and _ProductionVersion.Plant          = _WorkCenter.Plant
                                                                                  and _WorkCenter.WorkCenterTypeCode    = 'A'

    inner join             I_ProductPlant                as _ProductPlant         on  _ProductPlant.Product = _ProductionVersion.Material
                                                                                  and _ProductPlant.Plant   = _ProductionVersion.Plant

    inner join             vbap                          as _vbap                 on  _LogisticsOrder.SalesOrder     = _vbap.vbeln
                                                                                  and _LogisticsOrder.SalesOrderItem = _vbap.posnr

    left outer to one join I_SchedProdnPlngDets          as _plngdets             on  _plngdets.UserName          = $session.user
                                                                                  and _plngdets.SchedProdnAppName = 'SCH_PROD'

    left outer to one join I_WrkCtrUtilznPrsnlzn         as _prsnlzn              on _prsnlzn.UserName = $session.user

    left outer to one join I_CapPlngWrkCtrGrpRespyArea   as _wrkgrpaor            on  _wrkgrpaor.WorkCenterInternalID = _WorkCenter.WorkCenterInternalID
                                                                                  and _wrkgrpaor.Plant                = _ProductPlant.Plant
                                                                                  and _wrkgrpaor.UserID               = $session.user

    left outer to one join I_SDMAreaOfResponsibility     as _sdmaor               on  _sdmaor.Plant         = _ProductPlant.Plant
                                                                                  and _sdmaor.MRPController = _ProductPlant.MRPResponsible
                                                                                  and _sdmaor.UserID        = $session.user

{
      @Search: {defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.8}
  key _LogisticsOrder.SalesOrder     as SalesOrder,
  key _LogisticsOrder.SalesOrderItem as SalesOrderItem,
      _vbap.arktx                    as SalesDocumentItemText,

      @UI.hidden:true
      _LogisticsOrder.MRPController  as MRPController,
      @UI.hidden: true
      _LogisticsOrder.Plant          as Plant
}
where
              _LogisticsOrder.SalesOrder                        is not null
  and         _WorkCenter._Capacity.CapacityIsFinite            = 'X'
  and(
              _plngdets.IndustryType                            is null
    or(
              _BillOfOperationsType.BillOfOperationsApplication = _plngdets.IndustryType
    )
  )
  and(
    (
              _ProductPlant.MRPResponsible                      = _sdmaor.MRPController
      and     _ProductPlant.Plant                               = _sdmaor.Plant
      and(
              _prsnlzn.PlantMRPCtrlrRespyAreaIsRqd              = 'X'
        or(
              _prsnlzn.PlantMRPCtrlrRespyAreaIsRqd              = ' '
          and _prsnlzn.WorkCenterGroupRespyAreaIsRqd            = ' '
        )
      )
    )
    or(
              _WorkCenter.WorkCenterInternalID                  = _wrkgrpaor.WorkCenterInternalID
      and     _ProductPlant.Plant                               = _wrkgrpaor.Plant
      and     _prsnlzn.WorkCenterGroupRespyAreaIsRqd            = 'X'
    )
  )


union select distinct from I_PlannedOrder                as _PlannedOrder

  inner join               I_SchedProdnProductionVersion as _ProductionVersion    on  _PlannedOrder.Material          = _ProductionVersion.Material
                                                                                  and _PlannedOrder.MRPPlant          = _ProductionVersion.Plant
                                                                                  and _PlannedOrder.ProductionVersion = _ProductionVersion.ProductionVersion

  inner join               I_BillOfOperationsType        as _BillOfOperationsType on _ProductionVersion.BillOfOperationsType = _BillOfOperationsType.BillOfOperationsType

  inner join               I_WorkCenter                  as _WorkCenter           on  _ProductionVersion.ProductionLine = _WorkCenter.WorkCenter
                                                                                  and _ProductionVersion.Plant          = _WorkCenter.Plant
                                                                                  and _WorkCenter.WorkCenterTypeCode    = 'A'

  inner join               I_ProductPlant                as _ProductPlant         on  _ProductPlant.Product = _ProductionVersion.Material
                                                                                  and _ProductPlant.Plant   = _ProductionVersion.Plant

  inner join               vbap                          as _vbap                 on  _PlannedOrder.SalesOrder     = _vbap.vbeln
                                                                                  and _PlannedOrder.SalesOrderItem = _vbap.posnr

  left outer to one join   I_SchedProdnPlngDets          as _plngdets             on  _plngdets.UserName          = $session.user
                                                                                  and _plngdets.SchedProdnAppName = 'SCH_PROD'

  left outer to one join   I_WrkCtrUtilznPrsnlzn         as _prsnlzn              on _prsnlzn.UserName = $session.user

  left outer to one join   I_CapPlngWrkCtrGrpRespyArea   as _wrkgrpaor            on  _wrkgrpaor.WorkCenterInternalID = _WorkCenter.WorkCenterInternalID
                                                                                  and _wrkgrpaor.Plant                = _ProductPlant.Plant
                                                                                  and _wrkgrpaor.UserID               = $session.user

  left outer to one join   I_SDMAreaOfResponsibility     as _sdmaor               on  _sdmaor.Plant         = _ProductPlant.Plant
                                                                                  and _sdmaor.MRPController = _ProductPlant.MRPResponsible
                                                                                  and _sdmaor.UserID        = $session.user

{
      @Search: {defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.8}
  key _PlannedOrder.SalesOrder     as SalesOrder,
  key _PlannedOrder.SalesOrderItem as SalesOrderItem,
      _vbap.arktx                  as SalesDocumentItemText,

      @UI.hidden: true
      _PlannedOrder.MRPController  as MRPController,
      @UI.hidden: true
      _PlannedOrder.MRPPlant       as Plant
}
where
              _PlannedOrder.SalesOrder                          is not null
  and         _WorkCenter._Capacity.CapacityIsFinite            = 'X'
  and(
              _plngdets.IndustryType                            is null
    or(
              _BillOfOperationsType.BillOfOperationsApplication = _plngdets.IndustryType
    )
  )
  and(
    (
              _ProductPlant.MRPResponsible                      = _sdmaor.MRPController
      and     _ProductPlant.Plant                               = _sdmaor.Plant
      and(
              _prsnlzn.PlantMRPCtrlrRespyAreaIsRqd              = 'X'
        or(
              _prsnlzn.PlantMRPCtrlrRespyAreaIsRqd              = ' '
          and _prsnlzn.WorkCenterGroupRespyAreaIsRqd            = ' '
        )
      )
    )
    or(
              _WorkCenter.WorkCenterInternalID                  = _wrkgrpaor.WorkCenterInternalID
      and     _ProductPlant.Plant                               = _wrkgrpaor.Plant
      and     _prsnlzn.WorkCenterGroupRespyAreaIsRqd            = 'X'
    )
  )