@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
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CUSTOMER",
"I_JOURNALENTRY",
"I_JOURNALENTRYITEM",
"I_OPERATIONALACCTGDOCITEM",
"I_SAFTCONTROLLINGDOCUMENT",
"I_SUPPLIER",
"P_SAFTJOURNALENTRYLEDGER"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENTCATEGORY",
"I_ACCOUNTINGDOCUMENTTYPE",
"I_ACCOUNTINGDOCUMENTTYPETEXT",
"I_COMPANYCODE",
"I_FISCALYEARFORCOMPANYCODE"
],
"BASE":
[
"I_JOURNALENTRY"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/