Pph_Ddl_Mkal

DDL: PPH_DDL_MKAL SQL: V_PPH_MKAL Type: view

Production Version as Source of Supply

Pph_Ddl_Mkal is a CDS View that provides data about "Production Version as Source of Supply" in SAP S/4HANA. It reads from 9 data sources and exposes 32 fields with key fields matnr, werks, verid, berid, werks.

Data Sources (9)

SourceAliasJoin Type
P_MatlMRPArea mb inner
P_MatlMRPAreaStorLoc mbl inner
mkal mkal from
needed needed inner
needed needed inner
MDCV_E_T399D t399d inner
MDCV_E_T399D t399d inner
tcs41 tcs41 inner
tcs41 tcs41 inner

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName V_PPH_MKAL view
EndUserText.label Production Version as Source of Supply view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientDependent true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MIXED view

Fields (32)

KeyFieldSource TableSource FieldDescription
KEY matnr mkal matnr
KEY werks mkal werks
KEY verid mkal verid
KEY berid P_MatlMRPArea MRPArea
adatu mkal adatu
bstmi mkal bstmi
text1 mkal text1
plnty mkal plnty
plnnr mkal plnnr
alnal mkal alnal
stlal mkal stlal
stlan mkal stlan
serkz mkal serkz
alort mkal alort
elpro mkal elpro
prvbe mkal prvbe
matnr
KEY werks mkal werks
KEY verid mkal verid
KEY berid P_MatlMRPAreaStorLoc MRPArea
adatu mkal adatu
bstmi mkal bstmi
text1 mkal text1
plnty mkal plnty
plnnr mkal plnnr
alnal mkal alnal
stlal mkal stlal
stlan mkal stlan
serkz mkal serkz
alort mkal alort
elpro mkal elpro
prvbe mkal prvbe
@AbapCatalog.sqlViewName: 'V_PPH_MKAL'
@EndUserText.label: 'Production Version as Source of Supply'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientDependent: true
@ObjectModel.usageType: {serviceQuality: #X, sizeCategory: #L, dataClass: #MIXED}
define view Pph_Ddl_Mkal as 

-- MKALs without Receiving Storage Location (ALONG) 
-- -->  Valid for all MRP Areas of the corr. Plant --> Join with PPH_MATNR_BERID to return only the valid BERIDs of the material
  select from mkal as mkal
  inner join MDCV_E_T399D as t399d
    on t399d.werks = mkal.werks
  inner join tcs41 as tcs41  -- inner join needed since MKAL not valid for MRP if no TCS41 exists 
    on tcs41.cslid = t399d.cslid and tcs41.stlan = mkal.stlan
  inner join P_MatlMRPArea as mb
    on mb.Material = mkal.matnr and mb.MRPAreaPlant = mkal.werks --- and mbl.lgort = mkal.alort
  {
    key mkal.matnr,
    key mkal.werks,
    key mkal.verid,
    key mb.MRPArea as berid,
    case mkal.bdatu
      when '00000000' then '99991231'
      else mkal.bdatu
    end as bdatu,
    mkal.adatu,
    case mkal.bstma 
      when 0 then 9999999999.999
      else mkal.bstma
    end as bstma,
    mkal.bstmi,
    case mkal.mksp
      when '' then cast( 'X' as aut_source preserving type )
      else cast( '' as aut_source preserving type )
    end as aut_source,
    mkal.text1,
    mkal.plnty,
    mkal.plnnr,
    mkal.alnal,
    mkal.stlal,
    mkal.stlan,
    mkal.serkz as serkz,
    mkal.alort,
    mkal.elpro,
    mkal.prvbe,
    case mkal.stlan
      when '' then cast( '99' as cslpr preserving type )
      else tcs41.cslpr
    end as arang  
  }
  where mkal.mksp <> '1' and mkal.alort = ''
  
union all

-- MKALs with Receiving Storage Location (ALONG) 
-- --> Join with PPH_MATNR_BERID_LGORT to get only those BERIDs that belong to ALONG 
  select from mkal as mkal
  inner join MDCV_E_T399D as t399d
    on t399d.werks = mkal.werks
  inner join tcs41 as tcs41  -- inner join needed since MKAL not valid for MRP if no TCS41 exists
    on tcs41.cslid = t399d.cslid and tcs41.stlan = mkal.stlan
  inner join P_MatlMRPAreaStorLoc as mbl
    on mbl.Material = mkal.matnr and mbl.MRPAreaPlant = mkal.werks and mbl.StorageLocation = mkal.alort
  {
    key mkal.matnr,
    key mkal.werks,
    key mkal.verid,
    key mbl.MRPArea as berid,
    case mkal.bdatu
      when '00000000' then '99991231'
      else mkal.bdatu
    end as bdatu,
    mkal.adatu,
    case mkal.bstma 
      when 0 then 9999999999.999
      else mkal.bstma
    end as bstma,
    mkal.bstmi,
    case mkal.mksp
      when '' then cast( 'X' as aut_source preserving type )
      else cast( '' as aut_source preserving type )
    end as aut_source,
    mkal.text1,
    mkal.plnty,
    mkal.plnnr,
    mkal.alnal,
    mkal.stlal,
    mkal.stlan,
    mkal.serkz as serkz,
    mkal.alort,
    mkal.elpro,
    mkal.prvbe,
    case mkal.stlan
      when '' then cast( '99' as cslpr preserving type )
      else tcs41.cslpr
    end as arang  
  }
  where mkal.mksp <> '1' and mkal.alort <> ''
                
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"MDCV_E_T399D",
"P_MATLMRPAREA",
"P_MATLMRPAREASTORLOC",
"MKAL",
"TCS41"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/