P_OpActyBackflushByOrigComp

DDL: P_OPACTYBACKFLUSHBYORIGCOMP SQL: PMPEORDOCOMPBCKF Type: view COMPOSITE

P_OpActyBackflushByOrigComp is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_OpActyComponentAssignment, I_OpActyInstanceStatus, I_ReservationItem) and exposes 9 fields with key fields Reservation, CurrentReservationItem, CurrentRecordType, CurrentOpActyNtwkInstance, CurrentOpActyNtwkElement. It has 1 association to related views.

Data Sources (3)

SourceAliasJoin Type
I_OpActyComponentAssignment OpActyComponentAssignment inner
I_OpActyInstanceStatus OpActyInstanceStatus from
I_ReservationItem ReservationItem inner

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_MfgOrder _MfgOrder $projection.ManufacturingOrder = _MfgOrder.ManufacturingOrder

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PMPEORDOCOMPBCKF view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #B view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (9)

KeyFieldSource TableSource FieldDescription
ReferenceOrderasManufacturingOrder
KEY Reservation I_OpActyComponentAssignment Reservation
KEY CurrentReservationItem I_OpActyComponentAssignment ReservationItem
KEY CurrentRecordType I_OpActyComponentAssignment RecordType
KEY CurrentOpActyNtwkInstance I_OpActyComponentAssignment OpActyNtwkInstance
KEY CurrentOpActyNtwkElement I_OpActyComponentAssignment OpActyNtwkElement
MaterialBaseUnit I_ReservationItem BaseUnit
BOOOpBOMItemInternalID I_OpActyComponentAssignment BOOOpBOMItemInternalID
_MfgOrder _MfgOrder
@AbapCatalog.sqlViewName: 'PMPEORDOCOMPBCKF'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType: {serviceQuality: #B, sizeCategory: #XL, dataClass: #TRANSACTIONAL}
@VDM.viewType: #COMPOSITE
@VDM.private: true
define view P_OpActyBackflushByOrigComp
  as select from           I_OpActyInstanceStatus      as OpActyInstanceStatus
    inner join             I_OpActyComponentAssignment as OpActyComponentAssignment on  OpActyComponentAssignment.OpActyNtwkInstance = OpActyInstanceStatus.OpActyNtwkInstance
                                                                                    and OpActyComponentAssignment.OpActyNtwkElement  = OpActyInstanceStatus.OpActyNtwkElement
    inner join             I_ReservationItem           as ReservationItem           on  ReservationItem.Reservation     = OpActyComponentAssignment.Reservation
                                                                                    and ReservationItem.ReservationItem = OpActyComponentAssignment.ReservationItem
                                                                                    and ReservationItem.RecordType      = OpActyComponentAssignment.RecordType
    left outer to one join I_ReservationItem           as LeadingReservationItem    on  LeadingReservationItem.Reservation     = OpActyComponentAssignment.LeadingReservation
                                                                                    and LeadingReservationItem.ReservationItem = OpActyComponentAssignment.LeadingReservationItem
                                                                                    and LeadingReservationItem.RecordType      = OpActyComponentAssignment.LeadingReservationRecordType

  association [1..1] to I_MfgOrder as _MfgOrder on $projection.ManufacturingOrder = _MfgOrder.ManufacturingOrder
{
      --For the time being Related Reservations are alway in the same order
      --> Thus, they have same ManufacturingOrder and Reservation
  key ReservationItem.ReferenceOrder                  as ManufacturingOrder,
  key OpActyComponentAssignment.Reservation,
  key OpActyComponentAssignment.ReservationItem       as CurrentReservationItem,
  key OpActyComponentAssignment.RecordType            as CurrentRecordType,
  key OpActyComponentAssignment.OpActyNtwkInstance    as CurrentOpActyNtwkInstance,
  key OpActyComponentAssignment.OpActyNtwkElement     as CurrentOpActyNtwkElement,
      cast(case
        when OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.ReservationItem
        else OpActyComponentAssignment.LeadingReservationItem
      end as rspos preserving type )                  as ReservationItem,
      cast(case
        when OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.RecordType
        else OpActyComponentAssignment.LeadingReservationRecordType
      end as rsart preserving type )                  as RecordType,
      cast(case
        when OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.OpActyNtwkInstance
        else OpActyComponentAssignment.LeadingOpActyNtwkInstance
      end as mpe_oan_instance_id preserving type )    as OpActyNtwkInstance,
      cast(case
        when OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.OpActyNtwkElement
        else OpActyComponentAssignment.LeadingOpActyNtwkElement
      end as mpe_oan_element_number preserving type ) as OpActyNtwkElement,
      cast(case ReservationItem.DebitCreditCode
        when 'S' then round(fltp_to_dec( OpActyComponentAssignment.MfgOrderComponentUsageNetQty as abap.dec(13,4) ), 3) * -1
        else round(fltp_to_dec( OpActyComponentAssignment.MfgOrderComponentUsageNetQty as abap.dec(13,4) ), 3)
      end as kmpmg )                                  as MfgOrdCompUsageNetQtyWithSign,
      @Semantics.unitOfMeasure: true
      ReservationItem.BaseUnit                        as MaterialBaseUnit,
      cast(case
        when OpActyComponentAssignment.LeadingReservation = '0000000000' then ReservationItem.DebitCreditCode
        else LeadingReservationItem.DebitCreditCode
      end as shkzg preserving type )                  as DebitCreditCode,
      OpActyComponentAssignment.BOOOpBOMItemInternalID,

      _MfgOrder
}
where
      OpActyInstanceStatus._SASStatus.SASStatusCategory = 3 --Completed
  and ReservationItem.MatlCompIsMarkedForBackflush      = 'X'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_OPACTYCOMPONENTASSIGNMENT",
"I_OPACTYINSTANCESTATUS",
"I_RESERVATIONITEM",
"I_SASSTATUS"
],
"ASSOCIATED":
[
"I_MFGORDER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/