P_PL_SAFTMaterialDocRecdBasic

DDL: P_PL_SAFTMATERIALDOCRECDBASIC SQL: PPLSAFTMATDOCRCB Type: view COMPOSITE

P_PL_SAFTMaterialDocRecdBasic is a Composite CDS View in SAP S/4HANA. It reads from 7 data sources and exposes 25 fields with key fields CompanyCode, PL_GoodsMovementTypeCategory, Plant, StorageLocation, MaterialDocumentYear.

Data Sources (7)

SourceAliasJoin Type
I_MaterialDocumentRecord a from
I_MaterialDocumentRecord a union_all
I_MaterialDocumentRecord a union_all
I_MaterialDocumentRecord b inner
P_PL_SAFTGDSMVTTYPECONFIGN P_PL_SAFTGDSMVTTYPECONFIGN inner
P_PL_SAFTGDSMVTTYPECONFIGN P_PL_SAFTGDSMVTTYPECONFIGN inner
P_PL_SAFTGDSMVTTYPECONFIGN P_PL_SAFTGDSMVTTYPECONFIGN inner

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PPLSAFTMATDOCRCB view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #P view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (25)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_MaterialDocumentRecord CompanyCode
KEY PL_GoodsMovementTypeCategory c PL_GoodsMovementTypeCategory
KEY Plant I_MaterialDocumentRecord Plant
KEY StorageLocation I_MaterialDocumentRecord StorageLocation
KEY MaterialDocumentYear I_MaterialDocumentRecord MaterialDocumentYear
KEY MaterialDocument I_MaterialDocumentRecord MaterialDocument
KEY MaterialDocumentItem I_MaterialDocumentRecord MaterialDocumentItem
GoodsMovementType I_MaterialDocumentRecord GoodsMovementType
CompanyCode
KEY PL_GoodsMovementTypeCategory c PL_GoodsMovementTypeCategory
KEY Plant I_MaterialDocumentRecord Plant
KEY StorageLocation I_MaterialDocumentRecord StorageLocation
KEY MaterialDocumentYear I_MaterialDocumentRecord MaterialDocumentYear
KEY MaterialDocument I_MaterialDocumentRecord MaterialDocument
KEY MaterialDocumentItem I_MaterialDocumentRecord MaterialDocumentItem
GoodsMovementType I_MaterialDocumentRecord GoodsMovementType
CompanyCode
KEY PL_GoodsMovementTypeCategory I_MaterialDocumentRecord PL_GoodsMovementTypeCategory
KEY Plant I_MaterialDocumentRecord Plant
KEY StorageLocation I_MaterialDocumentRecord StorageLocation
KEY MaterialDocumentYear I_MaterialDocumentRecord MaterialDocumentYear
KEY MaterialDocument I_MaterialDocumentRecord MaterialDocument
KEY MaterialDocumentItem I_MaterialDocumentRecord MaterialDocumentItem
GoodsMovementType I_MaterialDocumentRecord GoodsMovementType
PL_MMDocumentHasAlwaysPriceAmt I_MaterialDocumentRecord PL_MMDocumentHasAlwaysPriceAmt
@AbapCatalog.sqlViewName: 'PPLSAFTMATDOCRCB'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #P
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_PL_SAFTMaterialDocRecdBasic

// Material movements 411, 412 for consignment (vendor)

  as select from I_MaterialDocumentRecord                                as a
    inner join   I_MaterialDocumentRecord                                as b on  b.MaterialDocumentYear = a.MaterialDocumentYear
                                                                              and b.MaterialDocument     = a.MaterialDocument
                                                                              and b.MaterialDocumentLine = a.MaterialDocumentParentLine
    inner join   P_PL_SAFTGDSMVTTYPECONFIGN(P_SAPClient:$session.client) as c on  c.CompanyCode          = b.CompanyCode
                                                                              and c.MaterialDocumentYear = b.MaterialDocumentYear
                                                                              and c.MaterialDocument     = b.MaterialDocument
                                                                              and c.MaterialDocumentItem = b.MaterialDocumentItem
                                                                              and row_number             = 1
{
  key a.CompanyCode,
  key c.PL_GoodsMovementTypeCategory,
  key a.Plant,
  key a.StorageLocation,
  key a.MaterialDocumentYear,
  key a.MaterialDocument,
  key a.MaterialDocumentItem,
      a.GoodsMovementType,
      c.PL_MMDocumentHasAlwaysPriceAmt

}
where
       a.MaterialDocumentRecordType   =  'MDOC'
  and  a.QuantityInBaseUnit           <> 0
  and  a.Material                     <> ''
  and  c.PL_GoodsMovementTypeCategory <> ''
  and(
       a.GoodsMovementType            =  '411'
    or a.GoodsMovementType            =  '412'
  )
  and  b.InventorySpecialStockType    =  'K'

union all

// Material movements 411, 412 not for onsignment (vendor)

select from              I_MaterialDocumentRecord                                as a

  left outer to one join I_MaterialDocumentRecord                                as b on  b.MaterialDocumentYear = a.MaterialDocumentYear
                                                                                      and b.MaterialDocument     = a.MaterialDocument
                                                                                      and b.MaterialDocumentLine = a.MaterialDocumentParentLine

  inner join             P_PL_SAFTGDSMVTTYPECONFIGN(P_SAPClient:$session.client) as c on  c.CompanyCode          = a.CompanyCode
                                                                                      and c.MaterialDocumentYear = a.MaterialDocumentYear
                                                                                      and c.MaterialDocument     = a.MaterialDocument
                                                                                      and c.MaterialDocumentItem = a.MaterialDocumentItem
                                                                                      and row_number             = 1

{
  key a.CompanyCode,
  key c.PL_GoodsMovementTypeCategory,
  key a.Plant,
  key a.StorageLocation,
  key a.MaterialDocumentYear,
  key a.MaterialDocument,
  key a.MaterialDocumentItem,
      a.GoodsMovementType,
      c.PL_MMDocumentHasAlwaysPriceAmt
}
where
       a.MaterialDocumentRecordType    =  'MDOC'
  and  a.QuantityInBaseUnit            <> 0
  and  a.Material                      <> ''
  and  c.PL_GoodsMovementTypeCategory  <> ''
  and(
       a.GoodsMovementType             =  '411'
    or a.GoodsMovementType             =  '412'
  )
  and  a.InventorySpecialStockType     <> 'K'
  and  ( b.InventorySpecialStockType is null or b.InventorySpecialStockType     <> 'K' )
  and(
       a.IsAutomaticallyCreated        =  ''
    or c.PL_MMDocAutomLinesAreDistinct =  'X'
  )


union all

// All other material movements

select from  I_MaterialDocumentRecord                                as a
  inner join P_PL_SAFTGDSMVTTYPECONFIGN(P_SAPClient:$session.client) as b on  b.CompanyCode          = a.CompanyCode
                                                                          and b.MaterialDocumentYear = a.MaterialDocumentYear
                                                                          and b.MaterialDocument     = a.MaterialDocument
                                                                          and b.MaterialDocumentItem = a.MaterialDocumentItem
                                                                          and row_number             = 1
{
  key a.CompanyCode,
  key b.PL_GoodsMovementTypeCategory,
  key a.Plant,
  key a.StorageLocation,
  key a.MaterialDocumentYear,
  key a.MaterialDocument,
  key a.MaterialDocumentItem,
      a.GoodsMovementType,
      b.PL_MMDocumentHasAlwaysPriceAmt
}
where
       a.MaterialDocumentRecordType    =  'MDOC'
  and  a.QuantityInBaseUnit            <> 0
  and  a.Material                      <> ''
  and  b.PL_GoodsMovementTypeCategory  <> ''
  and  a.GoodsMovementType             <> '411'
  and  a.GoodsMovementType             <> '412'
  and(
       a.IsAutomaticallyCreated        =  ''
    or b.PL_MMDocAutomLinesAreDistinct =  'X'
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MATERIALDOCUMENTRECORD"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/