P_PurOrdMaintainHeaderAll

DDL: P_PURORDMAINTAINHEADERALL SQL: PPOMAINTHDRALL Type: view CONSUMPTION

P_PurOrdMaintainHeaderAll is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (P_PurOrdMaintainHeaderActive, P_PurOrdMaintainHeaderDraft) and exposes 115 fields with key fields ID, PurchaseOrder, PurchaseOrderHeaderDraftUUID, PurchaseOrder, PurchaseOrderHeaderDraftUUID. It has 13 associations to related views.

Data Sources (2)

SourceAliasJoin Type
P_PurOrdMaintainHeaderActive active from
P_PurOrdMaintainHeaderDraft draft union_all

Associations (13)

CardinalityTargetAliasCondition
[0..1] I_Supplier active_supplier $projection.Supplier = active_supplier.Supplier
[0..1] I_Supplier active_invparty $projection.InvoicingParty = active_invparty.Supplier
[0..1] I_PurchasingOrganization active_ekorg $projection.PurchasingOrganization = active_ekorg.PurchasingOrganization
[0..1] I_PurchasingGroup active_ekgrp $projection.PurchasingGroup = active_ekgrp.PurchasingGroup
[1..1] I_CompanyCode active_t001 $projection.CompanyCode = active_t001.CompanyCode
[1..1] P_PurOrdMaintainHeaderActCalFs active_POHeaderCalFields $projection.PurchaseOrder = active_POHeaderCalFields.PurchaseOrder
[0..1] P_PurOrdMaintainHeaderDraft draft_header $projection.PurchaseOrder = draft_header.PurchaseOrder
[0..1] I_Supplier draft_supplier $projection.Supplier = draft_supplier.Supplier
[0..1] I_Supplier draft_invparty $projection.InvoicingParty = draft_invparty.Supplier
[0..1] I_PurchasingOrganization draft_ekorg $projection.PurchasingOrganization = draft_ekorg.PurchasingOrganization
[0..1] I_PurchasingGroup draft_ekgrp $projection.PurchasingGroup = draft_ekgrp.PurchasingGroup
[1..1] I_CompanyCode draft_t001 $projection.CompanyCode = draft_t001.CompanyCode
[1..1] P_PurOrdMaintainHeaderDrfCalFs draft_POHeaderCalFields $projection.PurchaseOrderHeaderDraftUUID = draft_POHeaderCalFields.PurchaseOrderHeaderDraftUUID

Annotations (5)

NameValueLevelField
VDM.viewType #CONSUMPTION view
VDM.private true view
AbapCatalog.sqlViewName PPOMAINTHDRALL view
AccessControl.authorizationCheck #CHECK view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (115)

KeyFieldSource TableSource FieldDescription
KEY ID
KEY PurchaseOrder P_PurOrdMaintainHeaderActive PurchaseOrder
KEY PurchaseOrderHeaderDraftUUID
DraftUUID
PurchasingDocumentCategory P_PurOrdMaintainHeaderActive PurchasingDocumentCategory
PurchasingDocumentType P_PurOrdMaintainHeaderActive PurchasingDocumentType
CompanyCode P_PurOrdMaintainHeaderActive CompanyCode
CompanyCodeName active_t001 CompanyCodeName
PurchasingOrganization P_PurOrdMaintainHeaderActive PurchasingOrganization
PurchasingOrganizationName active_ekorg PurchasingOrganizationName
PurchasingGroup P_PurOrdMaintainHeaderActive PurchasingGroup
PurchasingGroupName active_ekgrp PurchasingGroupName
Supplier P_PurOrdMaintainHeaderActive Supplier
SupplierName active_supplier SupplierName
Currency P_PurOrdMaintainHeaderActive Currency
PaymentTerms P_PurOrdMaintainHeaderActive PaymentTerms
CashDiscount1Days P_PurOrdMaintainHeaderActive CashDiscount1Days
CashDiscount2Days P_PurOrdMaintainHeaderActive CashDiscount2Days
NetPaymentDays P_PurOrdMaintainHeaderActive NetPaymentDays
CashDiscount1Percent P_PurOrdMaintainHeaderActive CashDiscount1Percent
CashDiscount2Percent P_PurOrdMaintainHeaderActive CashDiscount2Percent
ExchangeRate P_PurOrdMaintainHeaderActive ExchangeRate
IncotermsClassification P_PurOrdMaintainHeaderActive IncotermsClassification
IncotermsTransferLocation P_PurOrdMaintainHeaderActive IncotermsTransferLocation
IncotermsVersion P_PurOrdMaintainHeaderActive IncotermsVersion
IncotermsLocation1 P_PurOrdMaintainHeaderActive IncotermsLocation1
IncotermsLocation2 P_PurOrdMaintainHeaderActive IncotermsLocation2
CreatedByUser P_PurOrdMaintainHeaderActive CreatedByUser
PurchaseOrderDate P_PurOrdMaintainHeaderActive PurchaseOrderDate
LastChangeDateTime P_PurOrdMaintainHeaderActive LastChangeDateTime
LastChangeUser P_PurOrdMaintainHeaderActive LastChangeUser
InvoicingParty P_PurOrdMaintainHeaderActive InvoicingParty
InvoicingPartyName active_invparty SupplierName
ReleaseIsNotCompleted P_PurOrdMaintainHeaderActive ReleaseIsNotCompleted
IsHeld P_PurOrdMaintainHeaderActive IsHeld
NumberOfItems active_POHeaderCalFields NumberOfItems
PurchaseOrderNetAmount active_POHeaderCalFields NetValue
PurchasingDocumentStatus active_POHeaderCalFields PurchasingDocumentStatus
EditState P_PurOrdMaintainHeaderActive EditState
IsDraft
HasTwin P_PurOrdMaintainHeaderActive HasTwin
TwinPurchaseOrderHdrDraftUUID draft_header PurchaseOrderHeaderDraftUUID
TwinUUID
PurchasingDocumentCondition P_PurOrdMaintainHeaderActive PurchasingDocumentCondition
PricingProcedure P_PurOrdMaintainHeaderActive PricingProcedure
AddressID P_PurOrdMaintainHeaderActive AddressID
AddressName P_PurOrdMaintainHeaderActive AddressName
AddressStreetName P_PurOrdMaintainHeaderActive AddressStreetName
AddressHouseNumber P_PurOrdMaintainHeaderActive AddressHouseNumber
AddressPostalCode P_PurOrdMaintainHeaderActive AddressPostalCode
AddressCityName P_PurOrdMaintainHeaderActive AddressCityName
AddressPhoneNumber P_PurOrdMaintainHeaderActive AddressPhoneNumber
AddressFaxNumber P_PurOrdMaintainHeaderActive AddressFaxNumber
AddressRegion P_PurOrdMaintainHeaderActive AddressRegion
AddressCountry P_PurOrdMaintainHeaderActive AddressCountry
AddressCorrespondenceLanguage P_PurOrdMaintainHeaderActive AddressCorrespondenceLanguage
IsActiveEntity
char32asID
KEY PurchaseOrder P_PurOrdMaintainHeaderDraft PurchaseOrder
KEY PurchaseOrderHeaderDraftUUID P_PurOrdMaintainHeaderDraft PurchaseOrderHeaderDraftUUID
DraftUUID
PurchasingDocumentCategory P_PurOrdMaintainHeaderDraft PurchasingDocumentCategory
PurchasingDocumentType P_PurOrdMaintainHeaderDraft PurchasingDocumentType
CompanyCode P_PurOrdMaintainHeaderDraft CompanyCode
CompanyCodeName draft_t001 CompanyCodeName
PurchasingOrganization P_PurOrdMaintainHeaderDraft PurchasingOrganization
PurchasingOrganizationName draft_ekorg PurchasingOrganizationName
PurchasingGroup P_PurOrdMaintainHeaderDraft PurchasingGroup
PurchasingGroupName draft_ekgrp PurchasingGroupName
Supplier P_PurOrdMaintainHeaderDraft Supplier
SupplierName draft_supplier SupplierName
Currency P_PurOrdMaintainHeaderDraft Currency
PaymentTerms P_PurOrdMaintainHeaderDraft PaymentTerms
CashDiscount1Days P_PurOrdMaintainHeaderDraft CashDiscount1Days
CashDiscount2Days P_PurOrdMaintainHeaderDraft CashDiscount2Days
NetPaymentDays P_PurOrdMaintainHeaderDraft NetPaymentDays
CashDiscount1Percent P_PurOrdMaintainHeaderDraft CashDiscount1Percent
CashDiscount2Percent P_PurOrdMaintainHeaderDraft CashDiscount2Percent
ExchangeRate P_PurOrdMaintainHeaderDraft ExchangeRate
IncotermsClassification P_PurOrdMaintainHeaderDraft IncotermsClassification
IncotermsTransferLocation P_PurOrdMaintainHeaderDraft IncotermsTransferLocation
IncotermsVersion P_PurOrdMaintainHeaderDraft IncotermsVersion
IncotermsLocation1 P_PurOrdMaintainHeaderDraft IncotermsLocation1
IncotermsLocation2 P_PurOrdMaintainHeaderDraft IncotermsLocation2
CreatedByUser P_PurOrdMaintainHeaderDraft CreatedByUser
PurchaseOrderDate P_PurOrdMaintainHeaderDraft PurchaseOrderDate
LastChangeDateTime P_PurOrdMaintainHeaderDraft LastChangeDateTime
LastChangeUser P_PurOrdMaintainHeaderDraft LastChangeUser
InvoicingParty P_PurOrdMaintainHeaderDraft InvoicingParty
InvoicingPartyName draft_invparty SupplierName
ReleaseIsNotCompleted P_PurOrdMaintainHeaderDraft ReleaseIsNotCompleted
IsHeld P_PurOrdMaintainHeaderDraft IsHeld
NumberOfItems draft_POHeaderCalFields NumberOfItems
PurchaseOrderNetAmount draft_POHeaderCalFields NetValue
PurchasingDocumentStatus
char1endasEditState
IsDraft
char1endasHasTwin
TwinPurchaseOrderHdrDraftUUID
TwinUUID
PurchasingDocumentCondition P_PurOrdMaintainHeaderDraft PurchasingDocumentCondition
PricingProcedure P_PurOrdMaintainHeaderDraft PricingProcedure
AddressID P_PurOrdMaintainHeaderDraft AddressID
AddressName P_PurOrdMaintainHeaderDraft AddressName
AddressStreetName P_PurOrdMaintainHeaderDraft AddressStreetName
AddressHouseNumber P_PurOrdMaintainHeaderDraft AddressHouseNumber
AddressPostalCode P_PurOrdMaintainHeaderDraft AddressPostalCode
AddressCityName P_PurOrdMaintainHeaderDraft AddressCityName
AddressPhoneNumber P_PurOrdMaintainHeaderDraft AddressPhoneNumber
AddressFaxNumber P_PurOrdMaintainHeaderDraft AddressFaxNumber
AddressRegion P_PurOrdMaintainHeaderDraft AddressRegion
AddressCountry P_PurOrdMaintainHeaderDraft AddressCountry
AddressCorrespondenceLanguage P_PurOrdMaintainHeaderDraft AddressCorrespondenceLanguage
IsActiveEntity
IsEndOfPurposeBlocked
// =========================================================================

//   PO Maintenance: Purchase Order Headers (Active + Draft)

// =========================================================================


@VDM.viewType: #CONSUMPTION
@VDM.private: true
@AbapCatalog.sqlViewName: 'PPOMAINTHDRALL'
@AccessControl.authorizationCheck: #CHECK
@ClientHandling.algorithm: #SESSION_VARIABLE

define view P_PurOrdMaintainHeaderAll
     as select from P_PurOrdMaintainHeaderActive as active 

        association [0..1] to I_Supplier                     as active_supplier             on $projection.Supplier               = active_supplier.Supplier
        association [0..1] to I_Supplier                     as active_invparty             on $projection.InvoicingParty         = active_invparty.Supplier
        association [0..1] to I_PurchasingOrganization       as active_ekorg                on $projection.PurchasingOrganization = active_ekorg.PurchasingOrganization
        association [0..1] to I_PurchasingGroup              as active_ekgrp                on $projection.PurchasingGroup        = active_ekgrp.PurchasingGroup
        association [1..1] to I_CompanyCode                  as active_t001                 on $projection.CompanyCode            = active_t001.CompanyCode
        association [1..1] to P_PurOrdMaintainHeaderActCalFs as active_POHeaderCalFields    on $projection.PurchaseOrder          = active_POHeaderCalFields.PurchaseOrder
        association [0..1] to P_PurOrdMaintainHeaderDraft    as draft_header                on $projection.PurchaseOrder          = draft_header.PurchaseOrder 

     {
      key cast(CONCAT(':',REPLACE(REPLACE(active.PurchaseOrder,'~','~~'),':','~:'))  as abap.char(32)) as ID,
      key                                                                         active.PurchaseOrder as PurchaseOrder,
      key                                                                    cast('' as abap.char(32)) as PurchaseOrderHeaderDraftUUID,
                                                          hextobin('00000000000000000000000000000000') as DraftUUID,      
                                                                     active.PurchasingDocumentCategory as PurchasingDocumentCategory,
                                                                         active.PurchasingDocumentType as PurchasingDocumentType,
                                                                                    active.CompanyCode as CompanyCode,
                                                                           active_t001.CompanyCodeName as CompanyCodeName,  
                                                                         active.PurchasingOrganization as PurchasingOrganization,
                                                               active_ekorg.PurchasingOrganizationName as PurchasingOrganizationName,      
                                                                                active.PurchasingGroup as PurchasingGroup,
                                                                      active_ekgrp.PurchasingGroupName as PurchasingGroupName,
                                                                                       active.Supplier as Supplier,
                                                                          active_supplier.SupplierName as SupplierName,
                                                @Semantics.amount.currencyCode: true   active.Currency as Currency,
                                                                                   active.PaymentTerms as PaymentTerms,
                                                                              active.CashDiscount1Days as CashDiscount1Days,
                                                                              active.CashDiscount2Days as CashDiscount2Days,
                                                                                 active.NetPaymentDays as NetPaymentDays,
                                                                           active.CashDiscount1Percent as CashDiscount1Percent,
                                                                           active.CashDiscount2Percent as CashDiscount2Percent,      
                                                                                   active.ExchangeRate as ExchangeRate,
                                                                       active.IncotermsClassification  as IncotermsClassification,
                                                                      active.IncotermsTransferLocation as IncotermsTransferLocation,
                                                                               active.IncotermsVersion as IncotermsVersion,
                                                                             active.IncotermsLocation1 as IncotermsLocation1,
                                                                             active.IncotermsLocation2 as IncotermsLocation2,
                                                                                  active.CreatedByUser as CreatedByUser,
                                                                              active.PurchaseOrderDate as PurchaseOrderDate,
                                                                             active.LastChangeDateTime as LastChangeDateTime,
                                                                                 active.LastChangeUser as LastChangeUser,  
                                                                                 active.InvoicingParty as InvoicingParty,
                                                                          active_invparty.SupplierName as InvoicingPartyName,
                                                                          active.ReleaseIsNotCompleted as ReleaseIsNotCompleted,
                                                                                         active.IsHeld as IsHeld,
                                                                active_POHeaderCalFields.NumberOfItems as NumberOfItems, 
                                                                     active_POHeaderCalFields.NetValue as PurchaseOrderNetAmount,
                                                     active_POHeaderCalFields.PurchasingDocumentStatus as PurchasingDocumentStatus,
                                                                                      active.EditState as EditState,
                                                                              cast('' as abap.char(1)) as IsDraft,
                                                                                        active.HasTwin as HasTwin,
                                                             draft_header.PurchaseOrderHeaderDraftUUID as TwinPurchaseOrderHdrDraftUUID,
                                                   hextobin(draft_header.PurchaseOrderHeaderDraftUUID) as TwinUUID,                               
                                                                    active.PurchasingDocumentCondition as PurchasingDocumentCondition,
                                                                               active.PricingProcedure as PricingProcedure,  
                                                                                     active.AddressID  as AddressID,
                                                                                   active.AddressName  as AddressName,    
                                                                             active.AddressStreetName  as AddressStreetName,
                                                                            active.AddressHouseNumber  as AddressHouseNumber,
                                                                             active.AddressPostalCode  as AddressPostalCode,
                                                                               active.AddressCityName  as AddressCityName,
                                                                            active.AddressPhoneNumber  as AddressPhoneNumber,
                                                                              active.AddressFaxNumber  as AddressFaxNumber,         
                                                                                 active.AddressRegion  as AddressRegion,    
                                                                                active.AddressCountry  as AddressCountry,
                                                                 active.AddressCorrespondenceLanguage  as AddressCorrespondenceLanguage,
                                                                 cast('X' as abap.char(1))             as IsActiveEntity,
                                                                 IsEndOfPurposeBlocked                 as IsEndOfPurposeBlocked                  

     }

     union all select from P_PurOrdMaintainHeaderDraft as draft 

        association [0..1] to I_Supplier                     as draft_supplier          on $projection.Supplier                     = draft_supplier.Supplier
        association [0..1] to I_Supplier                     as draft_invparty          on $projection.InvoicingParty               = draft_invparty.Supplier
        association [0..1] to I_PurchasingOrganization       as draft_ekorg             on $projection.PurchasingOrganization       = draft_ekorg.PurchasingOrganization    
        association [0..1] to I_PurchasingGroup              as draft_ekgrp             on $projection.PurchasingGroup              = draft_ekgrp.PurchasingGroup   
        association [1..1] to I_CompanyCode                  as draft_t001              on $projection.CompanyCode                  = draft_t001.CompanyCode 
        association [1..1] to P_PurOrdMaintainHeaderDrfCalFs as draft_POHeaderCalFields on $projection.PurchaseOrderHeaderDraftUUID = draft_POHeaderCalFields.PurchaseOrderHeaderDraftUUID
                
     {
      key cast(draft.PurchaseOrderHeaderDraftUUID as abap.char(32))                    as ID,
      key                                                          draft.PurchaseOrder as PurchaseOrder,
      key                                           draft.PurchaseOrderHeaderDraftUUID as PurchaseOrderHeaderDraftUUID,
                                          hextobin(draft.PurchaseOrderHeaderDraftUUID) as DraftUUID,      
                                                      draft.PurchasingDocumentCategory as PurchasingDocumentCategory,
                                                          draft.PurchasingDocumentType as PurchasingDocumentType,
                                                                     draft.CompanyCode as CompanyCode,
                                                            draft_t001.CompanyCodeName as CompanyCodeName,        
                                                          draft.PurchasingOrganization as PurchasingOrganization,
                                                draft_ekorg.PurchasingOrganizationName as PurchasingOrganizationName,
                                                                 draft.PurchasingGroup as PurchasingGroup,
                                                       draft_ekgrp.PurchasingGroupName as PurchasingGroupName,      
                                                                        draft.Supplier as Supplier,
                                                           draft_supplier.SupplierName as SupplierName,
                                @Semantics.amount.currencyCode: true    draft.Currency as Currency,
                                                                    draft.PaymentTerms as PaymentTerms,
                                                               draft.CashDiscount1Days as CashDiscount1Days,
                                                               draft.CashDiscount2Days as CashDiscount2Days,
                                                                  draft.NetPaymentDays as NetPaymentDays,
                                                            draft.CashDiscount1Percent as CashDiscount1Percent,
                                                            draft.CashDiscount2Percent as CashDiscount2Percent,       
                                                                    draft.ExchangeRate as ExchangeRate,
                                                        draft.IncotermsClassification  as IncotermsClassification,
                                                       draft.IncotermsTransferLocation as IncotermsTransferLocation,
                                                                draft.IncotermsVersion as IncotermsVersion,
                                                              draft.IncotermsLocation1 as IncotermsLocation1,
                                                              draft.IncotermsLocation2 as IncotermsLocation2,
                                                                   draft.CreatedByUser as CreatedByUser,
                                                               draft.PurchaseOrderDate as PurchaseOrderDate,
                                                              draft.LastChangeDateTime as LastChangeDateTime,  
                                                                  draft.LastChangeUser as LastChangeUser,        
                                                                  draft.InvoicingParty as InvoicingParty,
                                                           draft_invparty.SupplierName as InvoicingPartyName,
                                                           draft.ReleaseIsNotCompleted as ReleaseIsNotCompleted,
                                                                          draft.IsHeld as IsHeld,
                                                 draft_POHeaderCalFields.NumberOfItems as NumberOfItems, 
                                                      draft_POHeaderCalFields.NetValue as PurchaseOrderNetAmount,
                                                                                    '' as PurchasingDocumentStatus,
                                                            case draft.PurchaseOrder 
                                                              when '' then cast('1'  as abap.char(1)) 
                                                              else         cast('3'  as abap.char(1))
                                                            end                        as EditState,
                                                             cast('X' as abap.char(1)) as IsDraft,
                                                            case draft.PurchaseOrder 
                                                              when '' then cast(''  as abap.char(1))
                                                              else         cast('X' as abap.char(1))
                                                            end                        as HasTwin,                                                             
                                                           cast( '' as abap.char(32))  as TwinPurchaseOrderHdrDraftUUID,
                                          hextobin('00000000000000000000000000000000') as TwinUUID,                                                                                                                       
                                                     draft.PurchasingDocumentCondition as PurchasingDocumentCondition,
                                                                draft.PricingProcedure as PricingProcedure,       
                                                                       draft.AddressID as AddressID,           
                                                                     draft.AddressName as AddressName,    
                                                               draft.AddressStreetName as AddressStreetName,
                                                              draft.AddressHouseNumber as AddressHouseNumber,
                                                               draft.AddressPostalCode as AddressPostalCode,
                                                                 draft.AddressCityName as AddressCityName,
                                                              draft.AddressPhoneNumber as AddressPhoneNumber,
                                                                draft.AddressFaxNumber as AddressFaxNumber,          
                                                                   draft.AddressRegion as AddressRegion,    
                                                                  draft.AddressCountry as AddressCountry,
                                                   draft.AddressCorrespondenceLanguage as AddressCorrespondenceLanguage,
                                                   cast(' ' as abap.char(1))           as IsActiveEntity,
                                                   cast(' ' as abap.char(1))           as IsEndOfPurposeBlocked                     
     }
                                                         
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_SUPPLIER",
"P_PURORDMAINTAINHEADERACTCALFS",
"P_PURORDMAINTAINHEADERACTIVE",
"P_PURORDMAINTAINHEADERDRAFT",
"P_PURORDMAINTAINHEADERDRFCALFS"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_SUPPLIER",
"P_PURORDMAINTAINHEADERACTCALFS",
"P_PURORDMAINTAINHEADERDRAFT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/