e_mrp_purchase_docs

DDL: PPH_MRP_PURCHASE_DOCS SQL: V_MRP_PURCH_DOC Type: view

e_mrp_purchase_docs is a CDS View in SAP S/4HANA. It reads from 5 data sources (ebkn, eket, ekkn, ekpo, ekpv).

Data Sources (5)

SourceAliasJoin Type
ebkn ebkn left_outer
eket eket left_outer
ekkn ekkn left_outer
ekpo ekpo inner
ekpv ekpv left_outer

Annotations (4)

NameValueLevelField
AbapCatalog.sqlViewName V_MRP_PURCH_DOC view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #P view
@AbapCatalog.sqlViewName: 'V_MRP_PURCH_DOC'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType: {serviceQuality: #P} /*sizeCategory: #L, dataClass: #TRANSACTIONAL}  former AMDP replaced by CDS*/

-- Deprecated: Replaced by I_MRPPurchaseRequisition and/or I_MRPPurchaseOrder

define view e_mrp_purchase_docs as 
  select
    ekko.ebeln as purchasingdoc,
    ekko.bstyp as purchasingdoccategory,
    ekko.bsart as purchasingdoctype,
    ekko.aedat as creationdate,
    ekko.ernam as createdbyuser,
    ekpo.ebelp as purchasingdocitem5,
    lpad(ekpo.ebelp, 6, '0') as purchasingdocitem6,
    eket.etenr as purchasingdocscheduleline,
    ekpo.pstyp as purchasingdocitemcategory,
    ekpo.loekz as purchasingdocdeletion,
    '00000000' as purchasingdocreleasedate,
    ekko.ekorg as purchasingorganization,
    ekko.ekgrp as purchasinggroup,
    ekpo.matnr as material,
    ekpo.werks as plant,
    ekko.reswk as supplyingplant,
    ekko.lifnr as vendor,
    '' as fixedvendor,
    ekpo.idnlf as materialidbyvendor,
    ekpo.sobkz as inventoryspecialstock,
    ekkn.vbeln as salesdocument,
    ekkn.vbelp as salesdocumentitem,
    ekkn.ps_psp_pnr as wbselementinternalid,
    ekpo.infnr as purchasinginforecord,
    ekpo.plifz as materialplanneddeliverydurn,
    ekpo.webaz as materialgoodsreceiptduration,
    ekpo.lmein as materialbaseunit,
    eket.bedat as purchasingdocschedulelinedate,
    '00000000' as requisitiondate,
    eket.eindt as deliverydate,
    eket.fixkz as purchasingdocumentisfixed,
    ekpo.fixmg as deliverydatequantityisfixed,
    ekpo.umrez as docqtytobaseqtynmrtr,
    ekpo.umren as docqtytobaseqtydnmntr,
    ekpo.untto as underdeliverytolrlmtratioinpct,    
    ekpo.kztlf as partialdeliveryisallowed,
    ekpo.menge as purchasingdocumentorderqty,
    ekpo.meins as purchasingdocorderqtyunit,
    ekko.waers as documentcurrency,
    ekpo.netwr as amountindocumentcurrency,
    ekpo.netpr as priceindocumentcurrency,
    eket.menge as scheduledquantity,
    eket.wemng as goodsreceiptquantity,
    (eket.menge - eket.wemng) as openquantity,
    cast(0 as bsmng) as orderedquantity,  
    eket.wadat as requestedgoodsissuedate,
    eket.lddat as requestedloadingdate,
    eket.eindt as requesteddeliverydate,
    eket.mbdat as productavailabilitydate,
    ekpo.kzabs as purchasingdocisackndbyvendor,
    ekpo.konnr as purchaseoutlineagreement,
    ekpo.ktpnr as purchaseoutlineagreementitem,
    ekpv.lprio as deliverypriority,
    ekpv.vkorg as salesorganization,
    ekpv.vtweg as distributionchannel,
    ekpv.spart as division,
--    case ekpo.bstyp
--      when 'L' then 
        case ekko.lphis
          when 'X' then 'X'
          else ''
        end  
--      else ''
--    end as docisscheduleagreement,
    as docisscheduleagreement,
    '' as docispurchaserequisition
  from ekko as ekko
    inner join ekpo as ekpo
      on ekko.mandt = ekpo.mandt and
         ekko.ebeln = ekpo.ebeln        
    left outer join eket as eket
      on ekpo.mandt = eket.mandt and
         ekpo.ebeln = eket.ebeln and           
         ekpo.ebelp = eket.ebelp
    left outer join ekpv as ekpv
      on ekpo.mandt = ekpv.mandt and
         ekpo.ebeln = ekpv.ebeln and           
         ekpo.ebelp = ekpv.ebelp
    left outer join ekkn as ekkn
      on ekkn.mandt = ekpo.mandt and
         ekkn.ebeln = ekpo.ebeln and           
         ekkn.ebelp = ekpo.ebelp and
         ekkn.zekkn = '01'
union all
  select 
    eban.banfn as purchasingdoc,
    eban.bstyp as purchasingdoccategory,
    eban.bsart as purchasingdoctype,
    eban.erdat as creationdate,
    eban.ernam as createdbyuser,
    eban.bnfpo as purchasingdocitem5,
    lpad(eban.bnfpo, 6, '0') as purchasingdocitem6,
    '0000' as purchasingdocscheduleline,
    eban.pstyp as purchasingdocitemcategory,
    eban.loekz as purchasingdocdeletion,    
    eban.frgdt as purchasingdocreleasedate,
    eban.ekorg as purchasingorganization,
    eban.ekgrp as purchasinggroup,
    eban.matnr as material,
    eban.werks as plant,
    eban.reswk as supplyingplant,
    eban.lifnr as vendor,
    eban.flief as fixedvendor,
    eban.idnlf as materialidbyvendor,
    eban.sobkz as inventoryspecialstock,
    ebkn.vbeln as salesdocument,
    ebkn.vbelp as salesdocumentitem,
    ebkn.ps_psp_pnr as wbselementinternalid,
    eban.infnr as purchasinginforecord,
    eban.plifz as materialplanneddeliverydurn,
    eban.webaz as materialgoodsreceiptduration,
    '   ' as materialbaseunit,
    '00000000' as purchasingdocschedulelinedate,    
    eban.badat as requisitiondate,    
    eban.lfdat as deliverydate,
    eban.fixkz as purchasingdocumentisfixed,
    '' as deliverydatequantityisfixed,
    1 as docqtytobaseqtynmrtr,
    1 as docqtytobaseqtydnmntr,    
    0 as underdeliverytolrlmtratioinpct,
    '' as partialdeliveryisallowed,
    eban.menge as purchasingdocumentorderqty,
    eban.meins as purchasingdocorderqtyunit,
    eban.waers as documentcurrency,
    0 as amountindocumentcurrency,
    eban.preis as priceindocumentcurrency,
    eban.menge as scheduledquantity,
    0 as goodsreceiptquantity,
    0 as openquantity,
    eban.bsmng as orderedquantity,
    '' as requestedgoodsissuedate,
    '' as requestedloadingdate,
    '' as requesteddeliverydate,
    '' as productavailabilitydate,
    '' as purchasingdocisackndbyvendor,
    eban.konnr as purchaseoutlineagreement,
    eban.ktpnr as purchaseoutlineagreementitem,
    '00' as deliverypriority,
    '' as salesorganization,
    '' as distributionchannel,
    '' as division,
    ' 'as docisscheduleagreement,
    'X' as docispurchaserequisition
  from eban as eban          
    left outer join ebkn as ebkn
      on ebkn.mandt = eban.mandt and
         ebkn.banfn = eban.banfn and           
         ebkn.bnfpo = eban.bnfpo and
         ebkn.zebkn = '01';
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"EBAN",
"EBKN",
"EKET",
"EKKN",
"EKKO",
"EKPO",
"EKPV"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/