P_SLSORDFLFMTSUPPROCSQNC

CDS View

P_SLSORDFLFMTSUPPROCSQNC is a CDS View in S/4HANA. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_SlsOrdFlfmtProcHierNode2 view union_all CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE 
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL

@VDM.private: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
--@VDM.viewType: #COMPOSITE
@VDM.viewType: #CONSUMPTION
@AbapCatalog.sqlViewName: 'PSDSOFPROCSQSUP'

define view P_SlsOrdFlfmtSupProcSqnc

--as select from I_MfgOrder                         as MFG
as select from I_ManufacturingOrder                        as MFG
    
    inner join I_SalesDocumentBasic               as SO                          on                 SO.SalesDocument              =                         MFG.SalesOrder
 
association[0..1] to I_PurchasingDocumentType     as _PurchaseOrderType          on _PurchaseOrderType.PurchasingDocumentCategory =                           'F'
                                                                                and        $projection.PurchaseOrderType          =          _PurchaseOrderType.PurchasingDocumentType     
association[0..1] to I_MfgOrderType               as _MfgOrderType               on        $projection.ManufacturingOrderType     =               _MfgOrderType.ManufacturingOrderType                            
association[0..1] to I_PurchasingDocumentStatus   as _PurchasingDocumentStatus   on        $projection.PurchasingDocumentStatus   =   _PurchasingDocumentStatus.PurchasingDocumentStatus     
association[0..1] to I_SlsOrdReltdPurProcFlfmtSts as _SlsOrdReltdPurProcFlfmtSts on        $projection.SlsOrdReltdPurProcFlfmtSts = _SlsOrdReltdPurProcFlfmtSts.SlsOrdReltdPurProcFlfmtSts 
association[0..1] to I_SlsOrdReltdMfgProcFlfmtSts as _SlsOrdReltdMfgProcFlfmtSts on        $projection.SlsOrdReltdMfgProcFlfmtSts = _SlsOrdReltdMfgProcFlfmtSts.SlsOrdReltdMfgProcFlfmtSts         

{
  //Preceding 

  key SO.SalesDocument,  
  key SO.SDDocumentCategory                as SalesDocumentCategory,  
      
  //Subsequent L1

  key cast( MFG.ManufacturingOrder                                 as subsequ_doc )     as L1SubsequentDoc, 
  key cast( cast( MFG.ManufacturingOrderCategory as abap.char(4) ) as subsequ_doc_cat ) as L1SubsequentDocCat,
  
  //Organisation

  SO.SalesOrganization,
  SO.DistributionChannel,
  SO.OrganizationDivision,
  
  //Category

  SO.SalesDocumentType,
  
  @ObjectModel.foreignKey.association: '_PurchaseOrderType'
  cast( '' as esart )                      as PurchaseOrderType,
  
  @ObjectModel.foreignKey.association: '_MfgOrderType'
  MFG.ManufacturingOrderType,
  
  //Overall SD Process Status

  cast( '' as gbstk )                      as L1OverallSDProcessStatus,    
  
  //Purchasing Document Status

  @ObjectModel.foreignKey.association: '_PurchasingDocumentStatus'
  cast( '' as mmpur_doc_status )           as PurchasingDocumentStatus,
  
  //Sales Order Related Purchase Process Fulfillment Status

  @ObjectModel.foreignKey.association: '_SlsOrdReltdPurProcFlfmtSts'
  cast( '' as slsordreltdpurprocflfmtsts ) as SlsOrdReltdPurProcFlfmtSts,

--AT30.6.2021 Finetuning SlsOrdReltdMfgProcFlfmtSts CE2111  
  //Sales Order Related Manufacturing Process Fulfillment Status

//  @ObjectModel.foreignKey.association: '_SlsOrdReltdMfgProcFlfmtSts'

//  cast(

//   case 

//    when MFG.MfgOrderActualStartDate         = '00000000'

//     and MFG.MfgOrderActualEndDate           = '00000000' 

//     and MFG.MfgOrderItemActualDeliveryDate  = '00000000' then 'A'

//      

//    when MFG.MfgOrderActualStartDate        != '00000000' 

//     and MFG.MfgOrderActualEndDate           = '00000000' 

//     and MFG.MfgOrderItemActualDeliveryDate  = '00000000' then 'B'   

//            

//    when MFG.MfgOrderActualEndDate          != '00000000'

//      or MFG.MfgOrderItemActualDeliveryDate != '00000000' then 'C'           

//     else  ''

//    end as slsordreltdmfgprocflfmtsts )    as SlsOrdReltdMfgProcFlfmtSts,

 @ObjectModel.foreignKey.association: '_SlsOrdReltdMfgProcFlfmtSts'
  cast(
   case 
    when ( MFG.MfgOrderActualStartDate         = '00000000' ) --and MFG.MfgOrderActualReleaseDate         = '00000000' )
     and --BuildingBlock "MfgOrder still open"
       ( --MFG.MfgOrderActualEndDate              = '00000000' --and MfgOrderItemActualDeliveryDate = '00000000'--regular processed PO is not yet finalized (Delivery Date not needed because of IsCompletelyDelivered-Flag) Update 7.7.21: no need for *ActualEndDate, because isCompletelyDelivered & *ConfirmedEndDate shall be sufficient ! 
               MFG.MfgOrderActualCompletionDate = '00000000'                                      --means is Not OrderIsTechnicallyCompleted, OrderIsClosed
           and MFG.IsMarkedForDeletion          = ' ' 
           and MFG.IsCompletelyDelivered = ' '             --means is Not OrderIsDeleted, OrderIsMarkedForDeletion, OrderIsDelivered   
           and MFG.MfgOrderConfirmedEndDate     = '00000000'                                      --means is Not OrderIsConfirmed   
        )   
            then 'A'
      
    when ( MFG.MfgOrderActualStartDate        != '00000000' ) --or MfgOrderActualReleaseDate != '00000000' )
     and --BuildingBlock "MfgOrder still open"
       ( --MFG.MfgOrderActualEndDate              = '00000000' --and MfgOrderItemActualDeliveryDate = '00000000'--regular processed PO is not yet finalized (Delivery Date not needed because of IsCompletelyDelivered-Flag) Update 7.7.21: no need for *ActualEndDate, because isCompletelyDelivered & *ConfirmedEndDate shall be sufficient ! 
               MFG.MfgOrderActualCompletionDate = '00000000'                                      --means is Not OrderIsTechnicallyCompleted, OrderIsClosed
           and MFG.IsMarkedForDeletion          = ' ' 
           and MFG.IsCompletelyDelivered = ' '             --means is Not OrderIsDeleted, OrderIsMarkedForDeletion, OrderIsDelivered   
           and MFG.MfgOrderConfirmedEndDate     = '00000000'                                      --means is Not OrderIsConfirmed   
        )   
            then 'B'
            
    when --BuildingBlock NOT ( "MfgOrder still open" )
      not ( --MFG.MfgOrderActualEndDate              = '00000000' --and MfgOrderItemActualDeliveryDate = '00000000'--regular processed PO is not yet finalized (Delivery Date not needed because of IsCompletelyDelivered-Flag) Update 7.7.21: no need for *ActualEndDate, because isCompletelyDelivered & *ConfirmedEndDate shall be sufficient ! 
               MFG.MfgOrderActualCompletionDate = '00000000'                                      --means is Not OrderIsTechnicallyCompleted, OrderIsClosed
           and MFG.IsMarkedForDeletion          = ' ' 
           and MFG.IsCompletelyDelivered = ' '             --means is Not OrderIsDeleted, OrderIsMarkedForDeletion, OrderIsDelivered   
           and MFG.MfgOrderConfirmedEndDate     = '00000000'                                      --means is Not OrderIsConfirmed   
        )   
      then 'C'           
     else  ''
    end as slsordreltdmfgprocflfmtsts )    as SlsOrdReltdMfgProcFlfmtSts,


---------------------BuildingBlock (taken from P_SalesOrderInSupplyMfgIssue1)
//ProdO is still open / Not finalized    

--BuildingBlock "MfgOrder still open"
//       ( --MfgOrderActualEndDate              = '00000000' --and MfgOrderItemActualDeliveryDate = '00000000'--regular processed PO is not yet finalized (Delivery Date not needed because of IsCompletelyDelivered-Flag) Update 7.7.21: no need for *ActualEndDate, because isCompletelyDelivered & *ConfirmedEndDate shall be sufficient ! 

//               MfgOrderActualCompletionDate = '00000000'                                      --means is Not OrderIsTechnicallyCompleted, OrderIsClosed

//           and IsMarkedForDeletion          = ' ' 

//           and IsCompletelyDelivered = ' '             --means is Not OrderIsDeleted, OrderIsMarkedForDeletion, OrderIsDelivered   

//           and MfgOrderConfirmedEndDate     = '00000000'                                      --means is Not OrderIsConfirmed   

//        )          

---------------------------


  //Associations   

  SO._SDDocumentCategory,
  
  SO._SalesOrganization,
  SO._DistributionChannel,
  SO._OrganizationDivision,
  
  SO._SalesDocumentType,
  _PurchaseOrderType,
  _MfgOrderType,
  
  _PurchasingDocumentStatus,
  _SlsOrdReltdPurProcFlfmtSts,
  _SlsOrdReltdMfgProcFlfmtSts       
}
where MFG.SalesOrderItem    != '000000'
  and (SO.SDDocumentCategory = 'C'  --> Order    
   or  SO.SDDocumentCategory = 'I') --> Order w/o charge

--------------------------------------------------------------------------
--------------------------------------------------------------------------
union all

select distinct 
           from P_SlsDocFlfmtProcHierarchyD33     as PO

     inner join I_SalesDocumentBasic              as SO                          on                 SO.SalesDocument              =                          PO.SalesOrder
 
association[0..1] to I_PurchasingDocumentType     as _PurchaseOrderType          on _PurchaseOrderType.PurchasingDocumentCategory =                           'F'
                                                                                and        $projection.PurchaseOrderType          =          _PurchaseOrderType.PurchasingDocumentType     
association[0..1] to I_MfgOrderType               as _MfgOrderType               on        $projection.ManufacturingOrderType     =               _MfgOrderType.ManufacturingOrderType                            
association[0..1] to I_PurchasingDocumentStatus   as _PurchasingDocumentStatus   on        $projection.PurchasingDocumentStatus   =   _PurchasingDocumentStatus.PurchasingDocumentStatus     
association[0..1] to I_SlsOrdReltdPurProcFlfmtSts as _SlsOrdReltdPurProcFlfmtSts on        $projection.SlsOrdReltdPurProcFlfmtSts = _SlsOrdReltdPurProcFlfmtSts.SlsOrdReltdPurProcFlfmtSts 
association[0..1] to I_SlsOrdReltdMfgProcFlfmtSts as _SlsOrdReltdMfgProcFlfmtSts on        $projection.SlsOrdReltdMfgProcFlfmtSts = _SlsOrdReltdMfgProcFlfmtSts.SlsOrdReltdMfgProcFlfmtSts         

{
  //Preceding 

  key SO.SalesDocument,  
  key SO.SDDocumentCategory                       as SalesDocumentCategory,  
      
  //Subsequent L1

  key cast( PO.PurchaseOrder as subsequ_doc )     as L1SubsequentDoc, 
  key cast( 'V'              as subsequ_doc_cat ) as L1SubsequentDocCat,
  
  //Organisation

  SO.SalesOrganization,
  SO.DistributionChannel,
  SO.OrganizationDivision,
  
  //Category

  SO.SalesDocumentType,
  
  @ObjectModel.foreignKey.association: '_PurchaseOrderType'
  PO.PurchaseOrderType, 
  
  @ObjectModel.foreignKey.association: '_MfgOrderType'
  cast( '' as manufacturingordertype )            as ManufacturingOrderType,

  //Overall SD Process Status

  cast(
    case when PO.POOverallProcessStatus = 'C'
          then PO.POOverallProcessStatus
        else ''
     end      
    as gbstk )                                    as L1OverallSDProcessStatus,    
  
  //Purchasing Document Status

  @ObjectModel.foreignKey.association: '_PurchasingDocumentStatus'
  PO.PurchasingDocumentStatus,
  
  //Sales Order Related Purchase Process Fulfillment Status

  @ObjectModel.foreignKey.association: '_SlsOrdReltdPurProcFlfmtSts'
  cast(
    case when PO.PurchasingDocumentStatus = '05'                        -- Follow-On Documents 
          then case when    (   PO.PODeliveryStatus = 'A' 
                             or PO.PODeliveryStatus = 'B') then 'B'     -- Not Completely Delivered
                  else       
                   case when     PO.POInvoiceStatus = 'C'  then 'K'     -- Completely Invoiced
                        when (   PO.POInvoiceStatus = 'B' 
                              or PO.POInvoiceStatus = 'A') then 'J'     -- Not Completely Invoiced
                      else 
                       case when PO.POInvoiceStatus  = ''  
                             and PO.PODeliveryStatus = 'C' then 'C'     -- Completely Delivered
                          else ''          
                        end   
                    end
                end 
        else PurchasingDocumentStatus 
     end     
    as slsordreltdpurprocflfmtsts )               as SlsOrdReltdPurProcFlfmtSts,
  
  //Sales Order Related Manufacturing Process Fulfillment Status

  @ObjectModel.foreignKey.association: '_SlsOrdReltdMfgProcFlfmtSts'
  cast( '' as slsordreltdmfgprocflfmtsts )        as SlsOrdReltdMfgProcFlfmtSts,
  
  //Associations   

  SO._SDDocumentCategory,
  
  SO._SalesOrganization,
  SO._DistributionChannel,
  SO._OrganizationDivision,
  
  SO._SalesDocumentType,  
  _PurchaseOrderType,
  _MfgOrderType,
 
  _PurchasingDocumentStatus, 
  _SlsOrdReltdPurProcFlfmtSts,
  _SlsOrdReltdMfgProcFlfmtSts      
}
where (   SO.SDDocumentCategory = 'C'  --> Order    
       or SO.SDDocumentCategory = 'I') --> Order w/o charge
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MANUFACTURINGORDER",
"I_SALESDOCUMENTBASIC",
"P_SLSDOCFLFMTPROCHIERARCHYD33"
],
"ASSOCIATED":
[
"I_DISTRIBUTIONCHANNEL",
"I_DIVISION",
"I_MFGORDERTYPE",
"I_PURCHASINGDOCUMENTSTATUS",
"I_PURCHASINGDOCUMENTTYPE",
"I_SALESDOCUMENTTYPE",
"I_SALESORGANIZATION",
"I_SDDOCUMENTCATEGORY",
"I_SLSORDRELTDMFGPROCFLFMTSTS",
"I_SLSORDRELTDPURPROCFLFMTSTS"
],
"BASE":
[
"I_SALESDOCUMENTBASIC"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/