P_MaterialLedgerDocumentRecord

DDL: P_MATERIALLEDGERDOCUMENTRECORD Type: view_entity BASIC Package: FCML4H_DISPLAY

Material Ledger Document Record

P_MaterialLedgerDocumentRecord is a Basic CDS View that provides data about "Material Ledger Document Record" in SAP S/4HANA. It reads from 2 data sources (mldoc, ckmlhd) and exposes 35 fields with key fields MaterialLedgerDocRef, CurrencyRole. Part of development package FCML4H_DISPLAY.

Data Sources (2)

SourceAliasJoin Type
mldoc doc from
ckmlhd hd inner

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
VDM.viewType #BASIC view
VDM.private true view
EndUserText.label Material Ledger Document Record view

Fields (35)

KeyFieldSource TableSource FieldDescription
KEY MaterialLedgerDocRef mldoc docref
KEY CurrencyRole mldoc curtp
Ledger mldoc rldnr
FiscalYearPeriod
MatlLdgrDocIsCostingRelevant mldoc xabr
MaterialLedgerCategory mldoc categ
ProcessCategory mldoc ptyp
CostEstimate mldoc kalnr
Material ckmlhd matnr
MaterialLedgerItemType mldoc posart
ProcurementAlternative mldoc bvalt
ProductionProcess mldoc process
ValuationQuantity mldoc quant
ValuationQuantityUnit mldoc meins
InventoryAmtInCCCrcy mldoc stval
PriceDifferenceAmtInCCCrcy mldoc prd
ExchRateDiffAmtInCoCodeCrcy mldoc kdm
Currency mldoc waers
ProductionOrder mldoc aufnr
EquivalenceNumberOfJntProdn mldoc eqnum
PostingDate mldoc budat
Plant mldoc werks
ReferenceDocumentType mldoc awtyp
SourceReferenceDocument mldoc awref
ReferenceDocumentContext mldoc aworg
ReferenceDocumentItem mldoc awitem
RefBusinessTransactionType mldoc glvor
MaterialLedgerTransactionType mldoc vgart
GoodsMovementType mldoc bwart
CostElement mldoc kstar
CostingRunReference _list runref
CostingRun _period run_id
CostingRunType _period run_type
LastDayOfMonthDate _period last_day
FirstDayOfMonthDate _period first_day
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
    serviceQuality: #C,
    sizeCategory: #XXL,
    dataClass: #MIXED
}
@VDM: {
  viewType: #BASIC,
  private: true
}
--@EndUserText.label: 'Material Ledger Document Record'
define view entity P_MaterialLedgerDocumentRecord
  as select from           mldoc         as doc
    inner join             ckmlhd        as hd      on doc.kalnr = hd.kalnr
    left outer to one join mlrunlist     as _list   on doc.kalnr               =  _list.kalnr
                                                    and(
                                                      doc.jahrper              =  _list.jahrper
                                                      or(
                                                        _list.from_jahrper     <> '0000000'
                                                        and _list.from_jahrper <= doc.jahrper
                                                        and _list.jahrper      >= doc.jahrper
                                                      )
                                                    )
    left outer to one join ckmlrunperiod as _period on  _period.run_id = _list.run_id
                                                    and _period.rldnr  = doc.rldnr
{
  key doc.docref                               as MaterialLedgerDocRef,
  key doc.curtp                                as CurrencyRole,
      doc.rldnr                                as Ledger,
      cast ( doc.jahrper as fins_fyearperiod ) as FiscalYearPeriod,
      doc.xabr                                 as MatlLdgrDocIsCostingRelevant,
      doc.categ                                as MaterialLedgerCategory,
      doc.ptyp                                 as ProcessCategory, //doc.PTYP ,

      doc.kalnr                                as CostEstimate,
      hd.matnr                                 as Material,
      doc.posart                               as MaterialLedgerItemType,

      doc.bvalt                                as ProcurementAlternative, //bvalt

      doc.process                              as ProductionProcess, //doc.PROCESS,


      @Semantics.quantity.unitOfMeasure: 'ValuationQuantityUnit'
      doc.quant                                as ValuationQuantity,     //quant

      doc.meins                                as ValuationQuantityUnit, //meins

      @Semantics.amount.currencyCode: 'Currency'
      doc.stval                                as InventoryAmtInCCCrcy,  //stval

      @Semantics.amount.currencyCode: 'Currency'
      doc.prd                                  as PriceDifferenceAmtInCCCrcy,  //prd

      @Semantics.amount.currencyCode: 'Currency'
      doc.kdm                                  as ExchRateDiffAmtInCoCodeCrcy, //kdm

      doc.waers                                as Currency, //waers


      doc.aufnr                                as ProductionOrder,
      doc.eqnum                                as EquivalenceNumberOfJntProdn,

      doc.budat                                as PostingDate,
      doc.werks                                as Plant,
      doc.awtyp                                as ReferenceDocumentType,
      doc.awref                                as SourceReferenceDocument,
      doc.aworg                                as ReferenceDocumentContext,
      doc.awitem                               as ReferenceDocumentItem,
      doc.glvor                                as RefBusinessTransactionType,
      doc.vgart                                as MaterialLedgerTransactionType,
      doc.bwart                                as GoodsMovementType,
      doc.kstar                                as CostElement,
      _list.runref                             as CostingRunReference, //runref

      _period.run_id                           as CostingRun, //period.RUN_ID,

      _period.run_type                         as CostingRunType,     //preiod.RUN_TYPE,

      _period.last_day                         as LastDayOfMonthDate, //LAST_DAY,

      _period.first_day                        as FirstDayOfMonthDate //FIRST_DAY


}
where
  (
        _list.runref like 'ACT__'
    and doc.rldnr    =    substring(_list.runref,4,2)
  )