P_PurDocStat

DDL: P_PURDOCSTAT SQL: PPODOCSTAT Type: view CONSUMPTION

P_PurDocStat is a Consumption CDS View in SAP S/4HANA. It reads from 4 data sources (I_PurchaseOrder, I_PurchaseOrderItem, C_Purdoclistpoitemstatusekbe, C_Purdoclistheadactstmsg) and exposes 2 fields with key fields PurchasingDocument, PurchasingDocumentItem.

Data Sources (4)

SourceAliasJoin Type
I_PurchaseOrder ekko left_outer
I_PurchaseOrderItem ekpo from
C_Purdoclistpoitemstatusekbe pos_ekbe left_outer
C_Purdoclistheadactstmsg pos_msg left_outer

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PPODOCSTAT view
VDM.viewType #CONSUMPTION view
VDM.private true view
AccessControl.authorizationCheck #PRIVILEGED_ONLY view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #B view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.lifecycle.status #DEPRECATED view
VDM.lifecycle.successor I_PurchaseOrderStatus view

Fields (2)

KeyFieldSource TableSource FieldDescription
KEY PurchasingDocument I_PurchaseOrderItem PurchaseOrder
KEY PurchasingDocumentItem I_PurchaseOrderItem PurchaseOrderItem
@AbapCatalog.sqlViewName: 'PPODOCSTAT'
@VDM.viewType: #CONSUMPTION
@VDM.private : true

@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@ClientHandling.algorithm: #SESSION_VARIABLE

@ObjectModel.usageType.serviceQuality: #B
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@VDM.lifecycle.status: #DEPRECATED
@VDM.lifecycle.successor: 'I_PurchaseOrderStatus' //Use I_PurchaseOrderStatus view for PurchasingDocumentStatus calculation similar to Manage app


define view P_PurDocStat
  as select from    I_PurchaseOrderItem          as ekpo
    left outer join I_PurchaseOrder              as ekko     on ekko.PurchaseOrder = ekpo.PurchaseOrder
    left outer join C_Purdoclistpoitemstatusekbe as pos_ekbe on  ekpo.PurchaseOrder     = pos_ekbe.PurchasingDocument
                                                             and ekpo.PurchaseOrderItem = pos_ekbe.PurchasingDocumentItem
    left outer join C_Purdoclistheadactstmsg     as pos_msg  on ekko.PurchaseOrder = pos_msg.appl_object_id
{
  key ekpo.PurchaseOrder       as PurchasingDocument,
  key ekpo.PurchaseOrderItem   as PurchasingDocumentItem,
      case ekpo.PurchasingDocumentDeletionCode
      when 'X' then cast('10' as abap.char(2)) --> "Deleted"
      when 'L' then cast('10' as abap.char(2)) --> "Deleted"
      when 'S' then cast('10' as abap.char(2)) --> "Deleted"
        else case ekko.PurchasingCompletenessStatus
          when 'X' then cast('01' as abap.char(2))
           else case ekko.ReleaseIsNotCompleted
              when 'X' then cast('02' as abap.char(2)) --> "In Approval"
                 else case ekpo.IsFinallyInvoiced
                     when 'X' then cast('21' as abap.char(2)) --> "Invoice Completed"
                         else case IsCompletelyDelivered
                             when 'X' then cast('22' as abap.char(2)) --> "Goods Receipt Completed"
                                else case pos_ekbe.follow_docs
                                   when 1 then cast('05' as abap.char(2)) --> "Follow-On Documents"
                                    when 0 then cast('23' as abap.char(2)) --> "Ordered

                                   else case pos_msg.msg
                                  when 1 then cast('04' as abap.char(2))
                                   else cast('03' as abap.char(2))


                                   end



                             end
                       end
                 end
              end
           end
      end                      as PurchasingDocumentStatus
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_PURDOCLISTHEADACTSTMSG",
"C_PURDOCLISTPOITEMSTATUSEKBE",
"I_PURCHASEORDER",
"I_PURCHASEORDERITEM"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/