C_NL_SAFTJournalItemRefDoc

DDL: C_NL_SAFTJOURNALITEMREFDOC Type: view_entity CONSUMPTION

Audit File NL Journal Item Ref Docs

C_NL_SAFTJournalItemRefDoc is a Consumption CDS View that provides data about "Audit File NL Journal Item Ref Docs" in SAP S/4HANA. It reads from 1 data source (I_JournalEntryItem) and exposes 12 fields with key fields CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem, Ledger.

Data Sources (1)

SourceAliasJoin Type
I_JournalEntryItem JournalEntryItem from

Annotations (7)

NameValueLevelField
VDM.viewType #CONSUMPTION view
AccessControl.authorizationCheck #MANDATORY view
EndUserText.label Audit File NL Journal Item Ref Docs view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view

Fields (12)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_JournalEntryItem CompanyCode
KEY FiscalYear I_JournalEntryItem FiscalYear
KEY AccountingDocument I_JournalEntryItem AccountingDocument
KEY LedgerGLLineItem I_JournalEntryItem LedgerGLLineItem
KEY Ledger I_JournalEntryItem Ledger
ReferenceDocument I_JournalEntryItem ReferenceDocument
ReferenceSDDocument CFinBillingDoc ReferenceSDDocument
ShipmentDocument GoodsMovementDoc MaterialDocument
_CompanyCode I_JournalEntryItem _CompanyCode
_FiscalYear I_JournalEntryItem _FiscalYear
_JournalEntry I_JournalEntryItem _JournalEntry
_Ledger I_JournalEntryItem _Ledger
@VDM.viewType: #CONSUMPTION
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #MANDATORY
@EndUserText.label: 'Audit File NL Journal Item Ref Docs'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
  serviceQuality: #X,
  sizeCategory: #XXL,
  dataClass: #MIXED
}
define view entity C_NL_SAFTJournalItemRefDoc
  as select from           I_JournalEntryItem          as JournalEntryItem

    left outer to one join P_NL_SAFTJounalItemCFinDoc  as CFinBillingDoc   on  CFinBillingDoc.CompanyCode                   =  JournalEntryItem.CompanyCode
                                                                           and CFinBillingDoc.CentralFinanceBillingDocument =  JournalEntryItem.ReferenceDocument
                                                                           and CFinBillingDoc.SenderLogicalSystem           =  JournalEntryItem.LogicalSystem
                                                                           and JournalEntryItem.ReferenceDocument           <> ''
                                                                           and JournalEntryItem.ReferenceDocumentType       =  'VBRK'

    left outer to one join P_NL_JournalItemCFinDocHist as CFinDocHist      on  CFinDocHist.CFinMaterialDocument         =  JournalEntryItem.ReferenceDocument
                                                                           and CFinDocHist.SenderLogicalSystem          =  JournalEntryItem.LogicalSystem
                                                                           and JournalEntryItem.ReferenceDocument       <> ''
                                                                           and (
                                                                              JournalEntryItem.ReferenceDocumentType    =  'RMRP'
                                                                              or JournalEntryItem.ReferenceDocumentType =  'CF3PM'
                                                                            )

    left outer to one join P_NL_SAFTGoodsMovDoc        as GoodsMovementDoc on  GoodsMovementDoc.DeliveryDocument           =  CFinBillingDoc.ReferenceSDDocument
                                                                           and GoodsMovementDoc.MaterialDocumentYear       =  JournalEntryItem.FiscalYear
                                                                           and GoodsMovementDoc.MaterialDocumentRecordType =  'MDOC'
                                                                           and CFinBillingDoc.ReferenceSDDocument          <> ''


{
      @ObjectModel.foreignKey.association: '_CompanyCode'
  key JournalEntryItem.CompanyCode           as CompanyCode,
      @ObjectModel.foreignKey.association: '_FiscalYear'
  key JournalEntryItem.FiscalYear            as FiscalYear,
      @ObjectModel.foreignKey.association: '_JournalEntry'
  key JournalEntryItem.AccountingDocument    as AccountingDocument,
  key JournalEntryItem.LedgerGLLineItem      as LedgerGLLineItem,
      @ObjectModel.foreignKey.association: '_Ledger'
  key JournalEntryItem.Ledger                as Ledger,

      JournalEntryItem.ReferenceDocument,
      CFinBillingDoc.ReferenceSDDocument,
      GoodsMovementDoc.MaterialDocument as ShipmentDocument, //shipDocRef


      case
        when CFinBillingDoc.CentralFinanceBillingDocument is not initial
         and CFinBillingDoc.SDDocumentCategory = 'O' //'O' = Credit Memo

        then left(JournalEntryItem._JournalEntry.DocumentReferenceID, 10)

        when JournalEntryItem.ReversalReferenceDocument is not initial
         and JournalEntryItem.IsReversed <> ''
        then JournalEntryItem.ReversalReferenceDocument

        else ''
      end                                    as InvoiceReference, //invoiceRef


      case
        when CFinBillingDoc.CentralFinanceSalesDocument is not null
         and CFinBillingDoc.CentralFinanceSalesDocument is not initial
         and CFinBillingDoc.SDDocumentCategory = 'M' //'M' = Invoice

        then CFinBillingDoc.CentralFinanceSalesDocument

        when CFinDocHist.CFinPurchasingDocument is not null
         and CFinDocHist.CFinPurchasingDocument is not initial
        then CFinDocHist.CFinPurchasingDocument

        else ''
      end                                    as OrderDocument, //orderRef


      JournalEntryItem._CompanyCode,
      JournalEntryItem._FiscalYear,
      JournalEntryItem._JournalEntry,
      JournalEntryItem._Ledger
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_JOURNALENTRY",
"I_JOURNALENTRYITEM",
"P_NL_JOURNALITEMCFINDOCHIST",
"P_NL_SAFTGOODSMOVDOC",
"P_NL_SAFTJOUNALITEMCFINDOC"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_FISCALYEARFORCOMPANYCODE",
"I_JOURNALENTRY",
"I_LEDGER"
],
"BASE":
[
"I_JOURNALENTRYITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/