I_SAFTJournalEntry

DDL: I_SAFTJOURNALENTRY SQL: ISAFTJRNENTRY Type: view COMPOSITE Package: GLO_FIN_IS_SAFT_GEN

SAF-T Journal Ledger Entry

I_SAFTJournalEntry is a Composite CDS View that provides data about "SAF-T Journal Ledger Entry" in SAP S/4HANA. It reads from 3 data sources (I_JournalEntry, P_SAFTJournalEntryLedger, I_SAFTControllingDocument) and exposes 28 fields with key fields CompanyCode, FiscalYear, AccountingDocument, Ledger. Part of development package GLO_FIN_IS_SAFT_GEN.

Data Sources (3)

SourceAliasJoin Type
I_JournalEntry a from
P_SAFTJournalEntryLedger b inner
I_SAFTControllingDocument c inner

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName ISAFTJRNENTRY view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
VDM.viewType #COMPOSITE view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label SAF-T Journal Ledger Entry view

Fields (28)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_JournalEntry CompanyCode
KEY FiscalYear I_JournalEntry FiscalYear
KEY AccountingDocument I_JournalEntry AccountingDocument
KEY Ledger P_SAFTJournalEntryLedger Ledger
AccountingDocumentType I_JournalEntry AccountingDocumentType
DocumentDate I_JournalEntry DocumentDate
PostingDate I_JournalEntry PostingDate
FiscalPeriod
SupplierelseendasSupplier
CustomerelseendasCustomer
AccountingDocCreatedByUser I_JournalEntry AccountingDocCreatedByUser
AccountingDocumentCategory I_JournalEntry AccountingDocumentCategory
SpecialGLCode
ReferenceDocumentType I_JournalEntry ReferenceDocumentType
OriginalReferenceDocument I_JournalEntry OriginalReferenceDocument
AccountingDocumentCreationDate I_JournalEntry AccountingDocumentCreationDate
AccountingDocumentHeaderText I_JournalEntry AccountingDocumentHeaderText
ExchangeRate I_JournalEntry ExchangeRate
CompanyCodeCurrency I_JournalEntry CompanyCodeCurrency
TransactionCurrency I_JournalEntry TransactionCurrency
SourceLedger P_SAFTJournalEntryLedger SourceLedger
TaxReportingDate I_JournalEntry TaxReportingDate
JrnlEntryCntrySpecificRef1 I_JournalEntry JrnlEntryCntrySpecificRef1
_CompanyCode I_JournalEntry _CompanyCode
_FiscalYear I_JournalEntry _FiscalYear
_AccountingDocumentType I_JournalEntry _AccountingDocumentType
_AccountingDocumentCategory I_JournalEntry _AccountingDocumentCategory
_AccountingDocumentTypeText I_JournalEntry _AccountingDocumentTypeText
@AbapCatalog.sqlViewName: 'ISAFTJRNENTRY'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'SAF-T Journal Ledger Entry'

define view I_SAFTJournalEntry as select from I_JournalEntry as a

  inner join P_SAFTJournalEntryLedger as b on b.CompanyCode = a.CompanyCode
                                          and b.FiscalYear  = a.FiscalYear
                                          and b.AccountingDocument = a.AccountingDocument
                                          and b.DebitAmountInCoCodeCrcy <> 0 
                                          and b.CreditAmountInCoCodeCrcy <> 0
                                          
  inner join I_SAFTControllingDocument as c on c.CompanyCode        = a.CompanyCode
                                           and c.FiscalYear         = a.FiscalYear
                                           and c.AccountingDocument = a.AccountingDocument
                                   
{
  @ObjectModel.foreignKey.association: '_CompanyCode'
  key a.CompanyCode,
  @ObjectModel.foreignKey.association: '_FiscalYear'
  key a.FiscalYear,
  key a.AccountingDocument,
  key b.Ledger,

  @ObjectModel.foreignKey.association: '_AccountingDocumentType'
  a.AccountingDocumentType,
  a.DocumentDate,
  a.PostingDate,
  a._JournalEntryItem[ 1: LedgerGLLineItem  = '000001' ].FiscalPeriod,
//  @ObjectModel.foreignKey.association: '_FiscalPeriod'

//  a.FiscalPeriod,

 case
   when a._JournalEntryItem[ 1:FinancialAccountType = 'K' ].Supplier is not null
    and a._JournalEntryItem[ 1:FinancialAccountType = 'K' ].Supplier is not initial
    then a._JournalEntryItem[ 1:FinancialAccountType = 'K' ].Supplier
   else ''
 end                                                             as Supplier,

 case
   when a._JournalEntryItem[ 1:FinancialAccountType = 'D' ].Customer  is not null
    and a._JournalEntryItem[ 1:FinancialAccountType = 'D' ].Customer is not initial
    then a._JournalEntryItem[ 1:FinancialAccountType = 'D' ].Customer
   else ''
 end                                                             as Customer,

  a.AccountingDocCreatedByUser,
  @ObjectModel.foreignKey.association: '_AccountingDocumentCategory'
  a.AccountingDocumentCategory,

  case
    when a._OperationalAcctgDocItem[ 1:FinancialAccountType = 'D' ].VATRegistration is not initial
      and a._OperationalAcctgDocItem[ 1:FinancialAccountType = 'D' ].VATRegistration is not null
      then substring ( a._OperationalAcctgDocItem[ 1:FinancialAccountType = 'D' ].VATRegistration, 1 , 2 )

    when a._OperationalAcctgDocItem[ 1:FinancialAccountType = 'K' ].VATRegistration is not initial
      and a._OperationalAcctgDocItem[ 1:FinancialAccountType = 'K' ].VATRegistration is not null
      then substring ( a._OperationalAcctgDocItem[ 1:FinancialAccountType = 'K' ].VATRegistration, 1 , 2 )

    else ''
   end                                                            as DelivOfGoodsDestCountry,

   case
    when a._JournalEntryItem[FinancialAccountType = 'D']._Customer.IsOneTimeAccount is not initial
    and a._JournalEntryItem[FinancialAccountType = 'D']._Customer.IsOneTimeAccount is not null
      then a._JournalEntryItem[FinancialAccountType = 'D']._Customer.IsOneTimeAccount

    when a._JournalEntryItem[FinancialAccountType = 'K']._Supplier.IsOneTimeAccount is not initial
    and a._JournalEntryItem[FinancialAccountType = 'K']._Supplier.IsOneTimeAccount is not null
      then a._JournalEntryItem[FinancialAccountType = 'K']._Supplier.IsOneTimeAccount

    else ''
   end                                                             as IsOneTimeAccount,
   
   coalesce( a._JournalEntryItem[1:FinancialAccountType = 'D' and SpecialGLCode != ''].SpecialGLCode, '' ) as SpecialGLCode, 

   a.ReferenceDocumentType,
   a.OriginalReferenceDocument,


   a.AccountingDocumentCreationDate,
   a.AccountingDocumentHeaderText,
   a.ExchangeRate,
   a.CompanyCodeCurrency,
   a.TransactionCurrency,
   b.SourceLedger,
   a.TaxReportingDate,
   a.JrnlEntryCntrySpecificRef1,   
   
   a._CompanyCode,
   a._FiscalYear,
   a._AccountingDocumentType,
   a._AccountingDocumentCategory,
//   a._FiscalPeriod,

   a._AccountingDocumentTypeText

}