P_STOCKBATCHINFO

CDS View

P_STOCKBATCHINFO is a CDS View in S/4HANA. It contains 19 fields. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_BatchInfo view from COMPOSITE

Fields (19)

KeyField CDS FieldsUsed in Views
berid berid 1
charg_sid charg_sid 1
companycodecurrency companycodecurrency 1
delkz delkz 1
kdauf kdauf 1
kdpos kdpos 1
lifnr lifnr 1
matnr matnr 1
mng01 mng01 1
mng01c mng01c 1
plaab plaab 1
planr planr 1
plumi plumi 1
pspel pspel 1
sobkz sobkz 1
sort1 sort1 1
sort2 sort2 1
vrfkz vrfkz 1
werks werks 1
@AbapCatalog.sqlViewName: 'pstckbatchinfo'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM.private: true
@ObjectModel.usageType: {serviceQuality: #D, sizeCategory: #XL, dataClass: #MASTER}
define view P_StockBatchInfo
  as select from pph_stock_lines_3 as pph_sl
    inner join   MDCV_E_T399D      as t399d on pph_sl.plant = t399d.werks
    inner join   v_mrp_currency    as curr  on pph_sl.plant = curr.plant
{
  material                              as matnr,
  max(pph_sl.plant)                     as werks,
  batch                                 as charg_sid,
  MRPArea                               as berid,
  mrpplanningsegmenttype                as plaab,
  mrpplanningsegment                    as planr,
  '0'                                   as sort1,
  '01'                                  as sort2,
  min(case mrpplanningsegmenttype
    when '02' then 'WB'
    when '20' then 'KB'
    when '22' then 'PB'
    else 'LB'        -- dummy-assignment
  end)                                  as delkz,
  min(InventorySpecialStockType)        as sobkz,
  min(Supplier)                         as lifnr, -- supplier as lifnr,
  min(salesorder)                       as kdauf,
  min(salesorderitem)                   as kdpos,
  min(projectinternalid)                as pspel,
  max(quantityisrelevantformrp)         as vrfkz,
  'B'                                   as plumi,
  sum(MRPElementOpenQuantity)           as mng01,
  sum(MRPElementOpenQuantity)           as mng01c, -- corrected stock incl. BSKRF (as FLTP!)
  curr.companycodecurrency
  --  case MRPElementCategory
  --    when 'B2' then sum(MRPElementOpenQuantity)
  --  end as mng03,
  // Salvage field has to come from customizing table

}
where
        mrpelementcategory = 'B1' -- Unrestricted-use Stock
  or    mrpelementcategory = 'B2' --and        -- Quality Inspection Stock-
                                  -- - Consideration checked already before
  or    mrpelementcategory = 'B3' -- Returns blocked Stock
  or    mrpelementcategory = 'B4' -- Stock Transfer Stock at SLOC level
  or(
        mrpelementcategory = 'B5' -- Stock Transfer Stock at Plant Level
    and t399d.kzumb        = 'X'
  )
  or    mrpelementcategory = 'B6' -- Stock in Transit
  or(
        mrpelementcategory = 'B7' -- Blocked Stock
    and t399d.xfan1        = 'X'
  )
  or(
        mrpelementcategory = 'B8' -- Restricted Stock
    and t399d.nfvbc        = 'X'
  )
group by
  material,
  batch,
  MRPArea,
  mrpplanningsegmenttype,
  mrpplanningsegment,
  curr.companycodecurrency; 
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"MDCV_E_T399D",
"PPH_STOCK_LINES_3",
"V_MRP_CURRENCY"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/