R_PRODUCTIONVERSIONTP

CDS View

Production Version Header

R_PRODUCTIONVERSIONTP is a CDS View in S/4HANA. Production Version Header. 6 CDS views read from this table.

CDS Views using this table (6)

ViewTypeJoinVDMDescription
A_ProductionVersion view_entity projection CONSUMPTION Production Version Header
C_LinkedExistingProdnVers view_entity from CONSUMPTION Linked Existing Production Version
C_LinkedProductionVersionAll view_entity from CONSUMPTION All Linked Production Version
C_ProductionVersion view_entity projection CONSUMPTION Production Version List
I_ProductionVersionTP view_entity projection TRANSACTIONAL Interface for BO Production Version - TP
P_ProductionVersionTP view_entity from COMPOSITE Production version details
@AccessControl.authorizationCheck: #MANDATORY
@EndUserText.label: 'Production Version Header'
@ObjectModel.usageType: { serviceQuality: #C, sizeCategory: #M, dataClass: #MASTER }
@VDM: { viewType: #TRANSACTIONAL, lifecycle.contract.type: #SAP_INTERNAL_API }
@ObjectModel.sapObjectNodeType.name: 'ProductionVersion'
define root view entity R_ProductionVersionTP
  as select from           I_ProductionVersion

    left outer to one join I_MaterialPlant as _MatlPlnt on  I_ProductionVersion.Material = _MatlPlnt.Material
                                                        and I_ProductionVersion.Plant    = _MatlPlnt.Plant

  association [0..1] to I_ProdnVersLock            as _ProdnVersLockVH          on  $projection.ProductionVersionLock = _ProdnVersLockVH.ProductionVersionIsLocked

  association [0..1] to I_ProdnVersLockText        as _ProdnVersLockText        on  $projection.ProductionVersionLock = _ProdnVersLockText.ProductionVersionIsLocked
                                                                                and _ProdnVersLockText.Language       = $session.system_language

  association [1..1] to I_MaterialText             as _MaterialText             on  $projection.Material   = _MaterialText.Material
                                                                                and _MaterialText.Language = $session.system_language

  association [0..1] to I_ProdnVersChkStsTxt       as _RoutingStatusText        on  $projection.ProductionVersionStatus = _RoutingStatusText.ProductionVersionStatus
                                                                                and _RoutingStatusText.Language         = $session.system_language

  association [0..1] to I_BillOfOperationsTypeText as _BillOfOperationsTypeText on  $projection.BillOfOperationsType   = _BillOfOperationsTypeText.BillOfOperationsType
                                                                                and _BillOfOperationsTypeText.Language = $session.system_language

  //  association [0..1] to I_MaterialBOM              as _MaterialBOM              on  $projection.Material              = _MaterialBOM.Material

  association [0..1] to I_RecmddProdnVersMatlBOM   as _MaterialBOM              on  $projection.Material                   =  _MaterialBOM.Material
                                                                                and $projection.Plant                      =  _MaterialBOM.Plant
                                                                                and $projection.BillOfMaterialVariant      =  _MaterialBOM.BillOfMaterialVariant
                                                                                and $projection.BillOfMaterialVariantUsage =  _MaterialBOM.BillOfMaterialVariantUsage
                                                                                and $projection.ValidityStartDate          >= _MaterialBOM.HeaderValidityStartDate
                                                                                and $projection.ValidityStartDate          <= _MaterialBOM.HeaderValidityEndDate

  association [0..*] to I_ProdnVersConstcyLogCount as _ConstcyLogCount          on  $projection.Material          = _ConstcyLogCount.Material
                                                                                and $projection.Plant             = _ConstcyLogCount.Plant
                                                                                and $projection.ProductionVersion = _ConstcyLogCount.ProductionVersion

  -- to Consistency Log
  composition [0..*] of R_ProdnVersConstcyLogTP    as _ConstcyLog
{

  key I_ProductionVersion.Material                                                               as Material,
  key I_ProductionVersion.Plant                                                                  as Plant,
  key I_ProductionVersion.ProductionVersion                                                      as ProductionVersion,
      I_ProductionVersion.ProductionVersionText                                                  as ProductionVersionText,
      I_ProductionVersion.ChangeHistoryCount                                                     as ChangeHistoryCount,
      I_ProductionVersion.ChangeNumber                                                           as ChangeNumber,
      I_ProductionVersion.CreationDate                                                           as CreationDate,
      I_ProductionVersion.CreatedByUser                                                          as CreatedByUser,
      I_ProductionVersion.LastChangeDate                                                         as LastChangeDate,
      I_ProductionVersion.LastChangedByUser                                                      as LastChangedByUser,
      @ObjectModel:{text.element:  [ 'BillOfOperationsTypeName' ]  }
      I_ProductionVersion.BillOfOperationsType                                                   as BillOfOperationsType,
      I_ProductionVersion.BillOfOperationsGroup                                                  as BillOfOperationsGroup,
      I_ProductionVersion.BillOfOperationsVariant                                                as BillOfOperationsVariant,
      I_ProductionVersion.BillOfMaterialVariantUsage                                             as BillOfMaterialVariantUsage,
      I_ProductionVersion.BillOfMaterialVariant                                                  as BillOfMaterialVariant,
      I_ProductionVersion.ProductionLine                                                         as ProductionLine,
      I_ProductionVersion.ProductionSupplyArea                                                   as ProductionSupplyArea,
      I_ProductionVersion.ProductionVersionGroup                                                 as ProductionVersionGroup,
      I_ProductionVersion.MainProduct                                                            as MainProduct,
      I_ProductionVersion.MaterialCostApportionmentStruc                                         as MaterialCostApportionmentStruc,
      I_ProductionVersion.IssuingStorageLocation                                                 as IssuingStorageLocation,
      I_ProductionVersion.ReceivingStorageLocation                                               as ReceivingStorageLocation,
      I_ProductionVersion.OriginalBatchReferenceMaterial                                         as OriginalBatchReferenceMaterial,
      I_ProductionVersion.QuantityDistributionKey                                                as QuantityDistributionKey,
      @ObjectModel:{text.element:  [ 'RoutingCheckStatusText' ]  }
      cast(I_ProductionVersion.ProductionVersionStatus as mpe_pv_rtg_chksts preserving type )    as ProductionVersionStatus,
      I_ProductionVersion.ProductionVersionLastCheckDate                                         as ProductionVersionLastCheckDate,
      I_ProductionVersion.RateBasedPlanningStatus                                                as RateBasedPlanningStatus,
      I_ProductionVersion.PreliminaryPlanningStatus                                              as PreliminaryPlanningStatus,
      I_ProductionVersion.BOMCheckStatus                                                         as BOMCheckStatus,
      I_ProductionVersion.ValidityStartDate                                                      as ValidityStartDate,
      I_ProductionVersion.ValidityEndDate                                                        as ValidityEndDate,

      @ObjectModel:{text.element:  [ 'ProductionVersionLockText' ]  }
      @ObjectModel.foreignKey.association: '_ProdnVersLockVH'
      cast(I_ProductionVersion.ProductionVersionIsLocked as mpe_pv_lock_status preserving type ) as ProductionVersionLock,

      I_ProductionVersion.ProdnVersIsAllowedForRptvMfg                                           as ProdnVersIsAllowedForRptvMfg,
      I_ProductionVersion.HasVersionCtrldBOMAndRouting                                           as HasVersionCtrldBOMAndRouting,
      I_ProductionVersion.PlanningAndExecutionBOMIsDiff                                          as PlanningAndExecutionBOMIsDiff,
      I_ProductionVersion.ExecBillOfMaterialVariantUsage                                         as ExecBillOfMaterialVariantUsage,
      I_ProductionVersion.ExecBillOfMaterialVariant                                              as ExecBillOfMaterialVariant,
      I_ProductionVersion.ExecBillOfOperationsType                                               as ExecBillOfOperationsType,
      I_ProductionVersion.ExecBillOfOperationsGroup                                              as ExecBillOfOperationsGroup,
      I_ProductionVersion.ExecBillOfOperationsVariant                                            as ExecBillOfOperationsVariant,
      I_ProductionVersion.Warehouse                                                              as EWMWarehouse,
      I_ProductionVersion.DestinationStorageBin                                                  as DestinationStorageBin,
      I_ProductionVersion.ProcurementType                                                        as ProcurementType,
      I_ProductionVersion.MaterialProcurementProfile                                             as MaterialProcurementProfile,
      I_ProductionVersion.UsgeProbltyWthVersCtrlInPct                                            as UsgeProbltyWthVersCtrlInPct,
      I_ProductionVersion.MaterialBaseUnit                                                       as MaterialBaseUnit,
      I_ProductionVersion.MaterialMinLotSizeQuantity                                             as MaterialMinLotSizeQuantity,
      I_ProductionVersion.MaterialMaxLotSizeQuantity                                             as MaterialMaxLotSizeQuantity,
      I_ProductionVersion.CostingLotSize                                                         as CostingLotSize,
      I_ProductionVersion.TargetProductionSupplyArea                                             as TargetProductionSupplyArea,
      _MatlPlnt.MRPController                                                                    as MRPController,
      _MaterialText.MaterialName                                                                 as MaterialName,
      I_ProductionVersion._Plant.PlantName                                                       as PlantName,
      I_ProductionVersion._ProductPlant.MRPResponsible                                           as MRPResponsible,

      @UI.hidden: true
      _RoutingStatusText.ProductionVersionStatusText                                             as RoutingCheckStatusText,

      @UI.hidden: true
      _ProdnVersLockText.ProductionVersionLockText,

      @UI.hidden: true
      _BillOfOperationsTypeText.BillOfOperationsTypeName,

      //      @Consumption.filter.hidden: true

      @UI.hidden: true
      _ProdnVersLockVH,

      case
      when _ConstcyLogCount[1:ProdnVersConstcyIssSvrtyLvl = 'E'].NumberOfProdnVersConstcyIssue > 0
      then '3'
      when _ConstcyLogCount[1:ProdnVersConstcyIssSvrtyLvl = 'W'].NumberOfProdnVersConstcyIssue > 0
      then '2'
      when _ConstcyLogCount[1:ProdnVersConstcyIssSvrtyLvl = 'S'].NumberOfProdnVersConstcyIssue > 0
      then '1'
      else
            case
            when ( I_ProductionVersion.ProductionVersionLastCheckDate != '00000000' )
            and  ( I_ProductionVersion.ProductionVersionStatus = '3' or I_ProductionVersion.BOMCheckStatus = '3'  )
            then '3'
            when ( I_ProductionVersion.ProductionVersionLastCheckDate != '00000000' )
            and  ( ( I_ProductionVersion.ProductionVersionStatus = '2'  or I_ProductionVersion.BOMCheckStatus = '2'  )
            and    ( I_ProductionVersion.ProductionVersionStatus != '3' or I_ProductionVersion.BOMCheckStatus != '3'  ) )
            then '2'
            when ( I_ProductionVersion.ProductionVersionLastCheckDate != '00000000' )
            and  ( ( I_ProductionVersion.ProductionVersionStatus = '1'  or I_ProductionVersion.BOMCheckStatus = '1'  )
            and    ( I_ProductionVersion.ProductionVersionStatus != '3' or I_ProductionVersion.BOMCheckStatus != '3'
            or       I_ProductionVersion.ProductionVersionStatus != '2' or I_ProductionVersion.BOMCheckStatus != '2' ) )
            then '1'
            when ( I_ProductionVersion.ProductionVersionLastCheckDate != '00000000' )
            and  ( I_ProductionVersion.ProductionVersionStatus = ''  and I_ProductionVersion.BOMCheckStatus = ''  )
            then ''
            else ''
            end
       end                                                                                       as OvrlProdnVersChkSts,
      //using cast to delink the Conversion Routine "NUMCV" on BillOfMaterial

      //      cast ( _MaterialBOM.BillOfMaterial as abap.char(8) )                                       as BillOfMaterial,

      //      _MaterialBOM.BillOfMaterialCategory                                                        as BillOfMaterialCategory,

      //      _BillOfMaterial.BOMHeaderText,



      /* Associations */
      I_ProductionVersion._BillOfOperations,
      I_ProductionVersion._BillOfOperationsGroup,
      I_ProductionVersion._BillOfOperationsType,
      I_ProductionVersion._ChangeMaster,
      I_ProductionVersion._IssuingStorageLocation,
      I_ProductionVersion._MainProduct,
      I_ProductionVersion._Material,
      I_ProductionVersion._MaterialBaseUnit,
      I_ProductionVersion._MatlCostApportionmentStruc,
      I_ProductionVersion._MatlProcurementProfile,
      I_ProductionVersion._OriglBatchReferenceMaterial,
      I_ProductionVersion._Plant,
      I_ProductionVersion._Product,
      I_ProductionVersion._ProductionLine,
      I_ProductionVersion._ProductionSupplyArea,
      I_ProductionVersion._ProductionVersionGroup,
      I_ProductionVersion._ProductPlant,
      I_ProductionVersion._QuantityDistributionKey,
      I_ProductionVersion._ReceivingStorageLocation,
      I_ProductionVersion._TargetProductionSupplyArea,
      _RoutingStatusText,
      _MaterialText,
      _BillOfOperationsTypeText,
      _ProdnVersLockText,
      _MaterialBOM,
      _ConstcyLog,
      _ConstcyLogCount
}