N_PurchaseOrder

DDL: N_PURCHASEORDER SQL: NPURCHASEORDER Type: view

Aux. View for Purchase Order Enterprise Search

N_PurchaseOrder is a CDS View that provides data about "Aux. View for Purchase Order Enterprise Search" in SAP S/4HANA. It reads from 1 data source (ekko) and exposes 56 fields with key fields PurchaseOrder, PurchaseOrderItem, AccountAssignmentNumber. It has 17 associations to related views.

Data Sources (1)

SourceAliasJoin Type
ekko ekko from

Associations (17)

CardinalityTargetAliasCondition
[0..1] I_Supplier _Supplier $projection.Supplier = _Supplier.Supplier
[0..1] I_User _CreatedByUser $projection.CreatedByUser = _CreatedByUser.UserID
[0..1] I_Plant _SupplyingPlant $projection.SupplyingPlant = _SupplyingPlant.Plant
[0..1] I_PurchasingOrganization _PurchasingOrganization $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization
[0..1] I_PurchasingGroup _PurchasingGroup $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup
[0..1] I_PurchasingDocumentType _PurchaseOrderType _PurchaseOrderType.PurchasingDocumentCategory = 'F' and $projection.PurchaseOrderType = _PurchaseOrderType.PurchasingDocumentType
[0..*] I_PurchasingDocumentTypeText _PurchaseOrderTypeName _PurchaseOrderTypeName.PurchasingDocumentCategory = 'F' and $projection.PurchaseOrderType = _PurchaseOrderTypeName.PurchasingDocumentType
[1..1] I_PurchaseOrderDeletionCode _PurchaseOrderDeletionCode $projection.PurchaseOrderDeletionCode = _PurchaseOrderDeletionCode.PurchaseOrderDeletionCode
[0..1] N_PaymentTerms _Paymentterms $projection.PaymentTerms=_Paymentterms.PaymentTerms
[0..1] I_CompanyCode _CompanyCode $projection.CompanyCode = _CompanyCode.CompanyCode
[0..1] I_IncotermsClassification _IncotermsClassification $projection.IncotermsClassification = _IncotermsClassification.IncotermsClassification
[0..1] I_Plant _Plant $projection.Plant = _Plant.Plant
[0..1] I_ProductGroup_2 _ProductGroup $projection.ProductGroup = _ProductGroup.ProductGroup
[0..1] I_BusinessArea _BusinessArea $projection.BusinessArea = _BusinessArea.BusinessArea
[0..1] I_WBSElementByInternalKey _WBSElementByInternalKey $projection.WBSElementInternalID = _WBSElementByInternalKey.WBSElementInternalID
[0..1] I_ControllingArea _ControllingArea $projection.ControllingArea = _ControllingArea.ControllingArea
[0..*] I_ProfitCenterText _ProfitCenterText $projection.ControllingArea = _ProfitCenterText.ControllingArea and $projection.ProfitCenter = _ProfitCenterText.ProfitCenter and $projection.CASystemDate < _ProfitCenterText.ValidityEndDate and $projection.CASystemDate >= _ProfitCenterText.ValidityStartDate

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName NPURCHASEORDER view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Aux. View for Purchase Order Enterprise Search view
ObjectModel.usageType.serviceQuality #A view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.auxiliaryEntity.for.entity R_PurchaseOrder view

Fields (56)

KeyFieldSource TableSource FieldDescription
KEY PurchaseOrder ekko ebeln
KEY PurchaseOrderItem ekpo ebelp
KEY AccountAssignmentNumber ekkn zekkn
CompanyCode ekko bukrs
CreatedByUser ekko ernam
CreationDate ekko aedat
DocumentCurrency ekko waers
IncotermsClassification ekko inco1
IncotermsTransferLocation ekko inco2
IncotermsLocation1 ekko inco2_l
IncotermsLocation2 ekko inco3_l
LastChangeDateTime ekko lastchangedatetime
PaymentTerms
PurchaseOrderDate ekko bedat
PurchaseOrderDeletionCode ekko loekz
Supplier
SupplyingPlant ekko reswk
PurchaseOrderType ekko bsart
PurchasingGroup ekko ekgrp
PurchasingOrganization ekko ekorg
PurchaseContract ekko konnr
ManufacturerMaterial ekpo ematn
Product
ProductGroup
NetAmount ekpo netwr
NetPriceAmount ekpo netpr
OrderQuantityUnit ekpo meins
OrderQuantity ekpo menge
OrderPriceUnit ekpo bprme
NetPriceQuantity
Plant ekpo werks
PurchaseOrderItemText ekpo txz01
PurchaseRequisition ekpo banfn
IsDeleted ekpo loekz
BusinessArea ekkn gsber
ControllingArea ekkn kokrs
ProfitCenter ekkn prctr
WBSElementInternalID ekkn ps_psp_pnr
CASystemDate
_CompanyCode _CompanyCode
_Supplier _Supplier
_CreatedByUser _CreatedByUser
_SupplyingPlant _SupplyingPlant
_PurchasingOrganization _PurchasingOrganization
_PurchasingGroup _PurchasingGroup
_PurchaseOrderType _PurchaseOrderType
_PurchaseOrderTypeName _PurchaseOrderTypeName
_PurchaseOrderDeletionCode _PurchaseOrderDeletionCode
_IncotermsClassification _IncotermsClassification
_Paymentterms _Paymentterms
_Plant _Plant
_ProductGroup _ProductGroup
_BusinessArea _BusinessArea
_WBSElementByInternalKey _WBSElementByInternalKey
_ControllingArea _ControllingArea
_ProfitCenterText _ProfitCenterText
@AbapCatalog.sqlViewName: 'NPURCHASEORDER'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Aux. View for Purchase Order Enterprise Search'

@ObjectModel:{
  usageType:{
    serviceQuality: #A,
    sizeCategory : #L,
    dataClass: #TRANSACTIONAL
  }
}

@VDM:{
  auxiliaryEntity:{
    for.entity: 'R_PurchaseOrder',
    usage.type: [#ENTERPRISE_SEARCH]
  }}
  

define view N_PurchaseOrder as select from ekko
                           left outer to many join ekpo
  on     ekko.ebeln = ekpo.ebeln 
                           left outer to many join ekkn
  on     ekpo.ebeln = ekkn.ebeln
  and    ekpo.ebelp = ekkn.ebelp  
  
 association [0..1] to I_Supplier                   as _Supplier                   on  $projection.Supplier = _Supplier.Supplier
 association [0..1] to I_User                       as _CreatedByUser              on  $projection.CreatedByUser = _CreatedByUser.UserID
 association [0..1] to I_Plant                      as _SupplyingPlant             on  $projection.SupplyingPlant = _SupplyingPlant.Plant
 association [0..1] to I_PurchasingOrganization     as _PurchasingOrganization     on  $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization
 association [0..1] to I_PurchasingGroup            as _PurchasingGroup            on  $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup
 association [0..1] to I_PurchasingDocumentType     as _PurchaseOrderType          on    _PurchaseOrderType.PurchasingDocumentCategory = 'F'
                                                                                    and $projection.PurchaseOrderType     = _PurchaseOrderType.PurchasingDocumentType
association  [0..*] to I_PurchasingDocumentTypeText  as _PurchaseOrderTypeName       on    _PurchaseOrderTypeName.PurchasingDocumentCategory = 'F'
                                                                                    and $projection.PurchaseOrderType     = _PurchaseOrderTypeName.PurchasingDocumentType                                                                                    
 association [1..1] to I_PurchaseOrderDeletionCode  as _PurchaseOrderDeletionCode  on  $projection.PurchaseOrderDeletionCode = _PurchaseOrderDeletionCode.PurchaseOrderDeletionCode
 association [0..1] to N_PaymentTerms               as _Paymentterms                on  $projection.PaymentTerms=_Paymentterms.PaymentTerms 
 association [0..1] to I_CompanyCode                as _CompanyCode                on  $projection.CompanyCode = _CompanyCode.CompanyCode
 association [0..1] to I_IncotermsClassification    as _IncotermsClassification    on  $projection.IncotermsClassification = _IncotermsClassification.IncotermsClassification
 association [0..1] to I_Plant                      as _Plant                     on  $projection.Plant = _Plant.Plant
 association [0..1] to I_ProductGroup_2             as _ProductGroup              on  $projection.ProductGroup = _ProductGroup.ProductGroup
 association [0..1] to I_BusinessArea               as _BusinessArea               on  $projection.BusinessArea = _BusinessArea.BusinessArea
 association [0..1] to I_WBSElementByInternalKey    as _WBSElementByInternalKey    on  $projection.WBSElementInternalID = _WBSElementByInternalKey.WBSElementInternalID 
 association [0..1] to I_ControllingArea            as _ControllingArea            on  $projection.ControllingArea = _ControllingArea.ControllingArea 
 association [0..*] to I_ProfitCenterText           as _ProfitCenterText           on  $projection.ControllingArea =  _ProfitCenterText.ControllingArea
                                                                                    and $projection.ProfitCenter   =  _ProfitCenterText.ProfitCenter
                                                                                    and $projection.CASystemDate    < _ProfitCenterText.ValidityEndDate
                                                                                    and $projection.CASystemDate    >= _ProfitCenterText.ValidityStartDate

  {
  
  key ekko.ebeln  as PurchaseOrder,
  key ekpo.ebelp  as PurchaseOrderItem,
  key ekkn.zekkn  as AccountAssignmentNumber,



//              Header fields

  
  ekko.bukrs                                                       as CompanyCode,
  ekko.ernam                                                       as CreatedByUser,
  ekko.aedat                                                       as CreationDate,
  ekko.waers                                                       as DocumentCurrency,
  ekko.inco1                                                       as IncotermsClassification,
  ekko.inco2                                                       as IncotermsTransferLocation,
  ekko.inco2_l                                                     as IncotermsLocation1,
  ekko.inco3_l                                                     as IncotermsLocation2,
  ekko.lastchangedatetime                                          as LastChangeDateTime,
  cast( ekko.zterm as farp_dzterm preserving type)                 as PaymentTerms,
  ekko.bedat                                                       as PurchaseOrderDate,
        @ObjectModel.foreignKey.association: '_PurchaseOrderDeletionCode'  
  ekko.loekz                                                       as PurchaseOrderDeletionCode,
        @ObjectModel.foreignKey.association: '_Supplier'
  cast ( ekko.lifnr as md_supplier preserving type)                as Supplier,
        @ObjectModel.foreignKey.association: '_SupplyingPlant'
  ekko.reswk                                                       as SupplyingPlant,
       @ObjectModel.foreignKey.association: '_PurchaseOrderType'
  ekko.bsart                                                       as PurchaseOrderType,       
       @ObjectModel.foreignKey.association: '_PurchasingGroup'
  ekko.ekgrp                                                       as PurchasingGroup,       
       @ObjectModel.foreignKey.association: '_PurchasingOrganization'
  ekko.ekorg                                                       as PurchasingOrganization, 
  ekko.konnr                                                       as PurchaseContract,


//          Item fields


   ekpo.ematn                                                      as ManufacturerMaterial,

 cast (ekpo.matnr as productnumber preserving type )               as Product,      
      @ObjectModel.foreignKey.association: '_ProductGroup'
 cast (ekpo.matkl as productgroup preserving type )                as ProductGroup,
       @Semantics.amount.currencyCode: 'DocumentCurrency'
  ekpo.netwr                                                       as NetAmount,
        @Semantics.amount.currencyCode: 'DocumentCurrency'
  ekpo.netpr                                                       as NetPriceAmount,
      @Semantics.unitOfMeasure: true
  ekpo.meins                                                       as OrderQuantityUnit, 
        @Semantics.quantity.unitOfMeasure: 'OrderQuantityUnit'
  ekpo.menge                                                       as OrderQuantity, 
      @Semantics.unitOfMeasure: true
  ekpo.bprme                                                       as OrderPriceUnit,   
      @Semantics.quantity.unitOfMeasure: 'OrderPriceUnit'
  cast (ekpo.peinh as vdm_price_unit preserving type)              as NetPriceQuantity,
      @ObjectModel.foreignKey.association: '_Plant'
  ekpo.werks                                                       as Plant,
      @Semantics.text: true
  ekpo.txz01                                                       as PurchaseOrderItemText,
  ekpo.banfn                                                       as PurchaseRequisition,
  ekpo.loekz                                                       as IsDeleted,
  
  
//             Account assignment

  
  
  @ObjectModel.foreignKey.association: '_BusinessArea' 
  ekkn.gsber                                                      as BusinessArea,
  ekkn.kokrs                                                      as ControllingArea,
  ekkn.prctr                                                      as ProfitCenter,
  ekkn.ps_psp_pnr                                                 as WBSElementInternalID,
  
   $session.system_date                                           as CASystemDate,
  



  _CompanyCode,
  _Supplier,
  _CreatedByUser,
  _SupplyingPlant,
  _PurchasingOrganization,
  _PurchasingGroup,
  _PurchaseOrderType,
  _PurchaseOrderTypeName,
  _PurchaseOrderDeletionCode,
  _IncotermsClassification,
  _Paymentterms,
  _Plant,
  _ProductGroup,
  _BusinessArea,
  _WBSElementByInternalKey,
  _ControllingArea,
  _ProfitCenterText

}
where
      ekko.bstyp           = 'F'
  and ekko.isaged          = ''
  and ekko.iseopblocked    = ''
  
  
  
 //_SUPPLIER.ORGANIZATIONBPNAME1, -> via _Supplier

//_SUPPLYINGPLANT.PLANTNAME, -> via _SupplyingPlant

//_PURCHASINGORGANIZATION.PURCHASINGORGANIZATIONNAME,via -> _PurchasingOrganization

//_PURCHASINGGROUP.PURCHASINGGROUPNAME, -> via _PurchasingGroup

//_PURCHASEORDERTYPE._TEXT[1: LANGUAGE = $parameters. P_Language].PURCHASINGDOCUMENTTYPENAME, -> via  _PurchaseOrderType

//_COMPANYCODE.COMPANYCODENAME, -> via _CompanyCode

//_PURCHASEORDERDELETIONCODE[1: ddlanguage = $parameters. P_Language].ddtext as PURCHASEORDERDELETIONCODENAME, -> via   _PurchaseOrderDeletionCode

//_INCOTERMSCLASSIFICATION._TEXT[1: LANGUAGE = $parameters. P_Language].INCOTERMSCLASSIFICATIONNAME, -> via _INCOTERMSCLASSIFICATION

//_PAYMENTTERMS.PAYMENTTERMSNAME, -> via _Paymentterms

//_CREATEDBYUSER.USERDESCRIPTION, -> via CreatedByUser

//_PURCHASEORDERITEM._PLANT.PLANTNAME as PURORDERITEMPLANT, -> via _Plant

//_PURCHASEORDERITEM._MATERIALGROUP._TEXT[1: LANGUAGE = $parameters. P_Language].MATERIALGROUPNAME, -> via -ProductGroup

//_PURCHASEORDERITEM._PURORDACCOUNTASSIGNMENT.WBSELEMENTEXTERNALID, -> via _WBSElementByInternalKey

//_PURCHASEORDERITEM._PURORDACCOUNTASSIGNMENT._BUSINESSAREA._TEXT[1: LANGUAGE = $parameters. P_Language].BUSINESSAREANAME, -> via _BusinessArea

//_PURCHASEORDERITEM._PURORDACCOUNTASSIGNMENT._WBSELEMENTBYINTERNALKEY.WBSDESCRIPTION, -> via _WBSElementByInternalKey

//_PURCHASEORDERITEM._PURORDACCOUNTASSIGNMENT._PROFITCENTERTEXT[1: LANGUAGE = $parameters. P_Language].PROFITCENTERNAME,

  





/*+[internal] {
"BASEINFO":
{
"FROM":
[
"EKKN",
"EKKO",
"EKPO"
],
"ASSOCIATED":
[
"I_BUSINESSAREA",
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_INCOTERMSCLASSIFICATION",
"I_PLANT",
"I_PRODUCTGROUP_2",
"I_PROFITCENTERTEXT",
"I_PURCHASEORDERDELETIONCODE",
"I_PURCHASINGDOCUMENTTYPE",
"I_PURCHASINGDOCUMENTTYPETEXT",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_SUPPLIER",
"I_USER",
"I_WBSELEMENTBYINTERNALKEY",
"N_PAYMENTTERMS"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/