m_v_m2s_pd_itm

DDL: M_V_M2S_PD_ITM SQL: CDS_M_M2S_PD_ITM Type: view Package: ODATA_MM_PUR_ME2STAR

View for Purchasing Document Item

m_v_m2s_pd_itm is a CDS View that provides data about "View for Purchasing Document Item" in SAP S/4HANA. It reads from 11 data sources and exposes 77 fields with key field ebelp. Part of development package ODATA_MM_PUR_ME2STAR.

Data Sources (11)

SourceAliasJoin Type
ekko _PurchasingDocument inner
adrp adrp left_outer
ekpo ekpo from
lfa1 lfa1 left_outer
m_v_m2s_pd_i_c pdi_calc left_outer
t001 t001 left_outer
t001w t001w left_outer
t001w t001w_sp left_outer
t024 t024 left_outer
t024e t024e left_outer
usr21 usr21 left_outer

Annotations (8)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.sqlViewName CDS_M_M2S_PD_ITM view
EndUserText.label View for Purchasing Document Item view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.sizeCategory #XL view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #REQUIRED view

Fields (77)

KeyFieldSource TableSource FieldDescription
ebeln
KEY ebelp ekpo ebelp
txz01
matnr ekpo matnr
matkl ekpo matkl
werks ekpo werks
lmein ekpo lmein
lgort ekpo lgort
bukrs ekpo bukrs
meins ekpo meins
bprme ekpo bprme
knttp ekpo knttp
loekz_i ekpo loekz
banfn ekpo banfn
bnfpo ekpo bnfpo
ematn ekpo ematn
menge ekpo menge
peinh ekpo peinh
netpr ekpo netpr
netwr ekpo netwr
ktmng ekpo ktmng
zwert ekpo zwert
statu ekpo statu
pstyp ekpo pstyp
stapo ekpo stapo
retpo ekpo retpo
umren ekpo umren
umrez ekpo umrez
elikz ekpo elikz
erekz ekpo erekz
wepos ekpo wepos
webre ekpo webre
repos ekpo repos
dec95aswkurs
bstyp ekko bstyp
bsart ekko bsart
aedat ekko aedat
ernam ekko ernam
lifnr ekko lifnr
zterm ekko zterm
ekorg ekko ekorg
ekgrp ekko ekgrp
waers ekko waers
bedat ekko bedat
kdatb ekko kdatb
kdate ekko kdate
kufix ekko kufix
konnr ekko konnr
reswk ekko reswk
loekz_h ekko loekz
angdt ekko angdt
submi ekko submi
ktwrt ekko ktwrt
description ekko description
iseopblocked ekko iseopblocked
name1
sortl lfa1 sortl
eknam t024 eknam
ekotx t024e ekotx
butxt t001 butxt
name1_p t001w name1
name1_sp t001w name1
name_text adrp name_text
wemng m_v_m2s_pd_i_c wemng
wewrt m_v_m2s_pd_i_c wewrt
remng m_v_m2s_pd_i_c remng
rewrt m_v_m2s_pd_i_c rewrt
qtymismatch m_v_m2s_pd_i_c qtymismatch
confmiss m_v_m2s_pd_i_c confmiss
wesbs m_v_m2s_pd_i_c wesbs
wgbez
batxt
statustext
cntf
cntk
cntl
releasevalue
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'CDS_M_M2S_PD_ITM'
@EndUserText.label: 'View for Purchasing Document Item'
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.sizeCategory: #XL
@AccessControl.authorizationCheck:#CHECK
@AccessControl.personalData.blocking: #REQUIRED
/***********************************************************************************************************/
/*   ME2STAR: Purchasing Document Item                                                                     */
/***********************************************************************************************************/
define view m_v_m2s_pd_itm
  as select from    ekpo           as ekpo
    inner join      ekko           as _PurchasingDocument on ekpo.ebeln = _PurchasingDocument.ebeln
    left outer join lfa1           as lfa1                on _PurchasingDocument.lifnr = lfa1.lifnr
    left outer join t024e          as t024e               on _PurchasingDocument.ekorg = t024e.ekorg
    left outer join t024           as t024                on _PurchasingDocument.ekgrp = t024.ekgrp
    left outer join t001           as t001                on ekpo.bukrs = t001.bukrs
    left outer join t001w          as t001w               on ekpo.werks = t001w.werks
    left outer join t001w          as t001w_sp            on _PurchasingDocument.reswk = t001w_sp.werks
    left outer join usr21          as usr21               on _PurchasingDocument.ernam = usr21.bname
    left outer join adrp           as adrp                on adrp.persnumber = usr21.persnumber
    left outer join m_v_m2s_pd_i_c as pdi_calc            on  ekpo.ebeln = pdi_calc.ebeln
                                                          and ekpo.ebelp = pdi_calc.ebelp

{
      -- Key fields
  key ekpo.ebeln,
  key ekpo.ebelp,

      -- Fields from table EKPO
      ekpo.txz01,
      ekpo.matnr,
      ekpo.matkl,
      ekpo.werks,
      ekpo.lmein,
      ekpo.lgort,
      ekpo.bukrs,
      ekpo.meins,
      ekpo.bprme,
      ekpo.knttp,
      ekpo.loekz                                       as loekz_i,
      ekpo.banfn,
      ekpo.bnfpo,
      ekpo.ematn,
      ekpo.menge,
      ekpo.peinh,
      ekpo.netpr,
      ekpo.netwr,
      ekpo.ktmng,
      ekpo.zwert,
      ekpo.statu,
      ekpo.pstyp,
      ekpo.stapo,
      ekpo.retpo,
      ekpo.umren,
      ekpo.umrez,
      ekpo.elikz,
      ekpo.erekz,
      ekpo.wepos,
      ekpo.webre,
      ekpo.repos,

      -- Fields from table EKKO
      cast(_PurchasingDocument.wkurs as abap.dec(9,5)) as wkurs,
      _PurchasingDocument.bstyp,
      _PurchasingDocument.bsart,
      _PurchasingDocument.aedat,
      _PurchasingDocument.ernam,
      _PurchasingDocument.lifnr,
      _PurchasingDocument.zterm,
      _PurchasingDocument.ekorg,
      _PurchasingDocument.ekgrp,
      _PurchasingDocument.waers,
      _PurchasingDocument.bedat,
      _PurchasingDocument.kdatb,
      _PurchasingDocument.kdate,
      _PurchasingDocument.kufix,
      _PurchasingDocument.konnr,
      _PurchasingDocument.reswk,
      _PurchasingDocument.loekz                        as loekz_h,
      _PurchasingDocument.angdt,
      _PurchasingDocument.submi,
      _PurchasingDocument.ktwrt,
      _PurchasingDocument.description,
      _PurchasingDocument.iseopblocked,

      -- Fields from other tables
      lfa1.name1,
      lfa1.sortl,
      t024.eknam,
      t024e.ekotx,
      t001.butxt,
      t001w.name1                                      as name1_p,
      t001w_sp.name1                                   as name1_sp,
      adrp.name_text,

      -- Calculated fields from DDL m_v_m2s_pd_i_c
      pdi_calc.status                                  as status,
      pdi_calc.wemng                                   as wemng,
      pdi_calc.wewrt                                   as wewrt,
      pdi_calc.remng                                   as remng,
      pdi_calc.rewrt                                   as rewrt,

      pdi_calc.valuemismatch,
      pdi_calc.qtymismatch,
      pdi_calc.confmiss,
      pdi_calc.wesbs                                   as wesbs,

      case pdi_calc.status
      when '23' then cast('X' as abap.char(1))
      when '24' then cast('X' as abap.char(1))
      when '05' then cast('X' as abap.char(1))
      else
       cast('' as abap.char(1))

       end                                             as postgr,

      -- Placeholder fields (to be calculated in ABAP)
      cast('' as abap.char(40))                        as maktx,
      cast('' as abap.char(20))                        as wgbez,
      cast('' as abap.char(20))                        as batxt,
      cast('' as abap.char(40))                        as statustext,
      cast(0 as abap.int4)                             as cntf,
      cast(0 as abap.int4)                             as cntk,
      cast(0 as abap.int4)                             as cntl,
      cast(0 as abap.quan(15,3))                       as releasequantity,
      ''                                               as contractitemusage,
      cast(0 as abap.curr(19,2))                       as releasevalue,
      -- Source of Supply
      case _PurchasingDocument.lifnr when '' then cast(_PurchasingDocument.reswk as abap.char(10))
                      else         cast(_PurchasingDocument.lifnr as abap.char(10))
      end                                              as sosid,
      case _PurchasingDocument.lifnr when '' then cast(t001w_sp.name1 as abap.char(100))
                      else         cast(lfa1.name1  as abap.char(100))
      end                                              as sosname

}