I_SAFTAccountingHeader

DDL: I_SAFTACCOUNTINGHEADER SQL: ISAFTACCHEADER Type: view COMPOSITE

SAF-T Accounting Header

I_SAFTAccountingHeader is a Composite CDS View that provides data about "SAF-T Accounting Header" in SAP S/4HANA. It reads from 1 data source (I_AccountingDocument) and exposes 45 fields with key fields CompanyCode, AccountingDocument, FiscalYear. It has 3 associations to related views.

Data Sources (1)

SourceAliasJoin Type
I_AccountingDocument a from

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_SAFTAccountingTaxCheck _TotalItems _TotalItems.AccountingDocument = a.AccountingDocument and _TotalItems.CompanyCode = a.CompanyCode and _TotalItems.FiscalYear = a.FiscalYear
[0..1] I_ReversalReason _RevReason _RevReason.ReversalReason = a.ReversalReason
[0..1] I_AccountingDocument _ReversalDocument _ReversalDocument.AccountingDocument = a.ReverseDocument and _ReversalDocument.FiscalYear = a.ReverseDocumentFiscalYear and _ReversalDocument.CompanyCode = a.CompanyCode

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName ISAFTACCHEADER view
AbapCatalog.compiler.compareFilter true view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
AbapCatalog.preserveKey true view
EndUserText.label SAF-T Accounting Header view

Fields (45)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_AccountingDocument CompanyCode
KEY AccountingDocument I_AccountingDocument AccountingDocument
KEY FiscalYear I_AccountingDocument FiscalYear
ReverseDocument I_AccountingDocument ReverseDocument
IsReversed I_AccountingDocument IsReversed
IsReversal I_AccountingDocument IsReversal
ReverseDocumentFiscalYear I_AccountingDocument ReverseDocumentFiscalYear
AccountingDocumentCreationDate I_AccountingDocument AccountingDocumentCreationDate
CreationTime I_AccountingDocument CreationTime
ReversalReason I_AccountingDocument ReversalReason
AccountingDocumentCategory I_AccountingDocument AccountingDocumentCategory
FiscalPeriod I_AccountingDocument FiscalPeriod
DocumentDate I_AccountingDocument DocumentDate
PostingDate I_AccountingDocument PostingDate
AccountingDocumentType I_AccountingDocument AccountingDocumentType
CompanyCodeCurrency I_AccountingDocument CompanyCodeCurrency
CreatedByUser I_AccountingDocument AccountingDocCreatedByUser
CustomerelseendasCustomer
CustomerPaymentTerms
CashDiscountBaseAmount
CashDiscount1Percent
CashDiscount2Percent
CashDiscount1DueDate
CashDiscount2DueDate
AccountingDocumentItem
TransactionCurrency I_AccountingDocument Currency
ExchangeRate I_AccountingDocument ExchangeRate
AmountInTransactionCurrency
AmountInCompanyCodeCurrency
IsOneTimeAccount
DelivOfGoodsDestCountry
PaymentMethod
SpecialGLCode
ReferenceDocumentType I_AccountingDocument ReferenceDocumentType
OriginalReferenceDocument I_AccountingDocument OriginalReferenceDocument
_Currency _Currency
_CompanyCodeCurrency _CompanyCodeCurrency
_TotalItems _TotalItems
_AccountingDocumentCategory _AccountingDocumentCategory
_CompanyCode _CompanyCode
_AccountingDocumentType _AccountingDocumentType
_OperationalAcctgDocItem _OperationalAcctgDocItem
_ReversalDocument _ReversalDocument
_RevReason _RevReason
_FiscalYear _FiscalYear
@AbapCatalog.sqlViewName: 'ISAFTACCHEADER'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@AbapCatalog.preserveKey:true
@EndUserText.label: 'SAF-T Accounting Header'
define view I_SAFTAccountingHeader
  as select from I_AccountingDocument as a

  association [0..1] to I_SAFTAccountingTaxCheck as _TotalItems       on  _TotalItems.AccountingDocument = a.AccountingDocument
                                                                      and _TotalItems.CompanyCode        = a.CompanyCode
                                                                      and _TotalItems.FiscalYear         = a.FiscalYear

  association [0..1] to I_ReversalReason         as _RevReason        on  _RevReason.ReversalReason = a.ReversalReason

  association [0..1] to I_AccountingDocument     as _ReversalDocument on  _ReversalDocument.AccountingDocument = a.ReverseDocument
                                                                      and _ReversalDocument.FiscalYear         = a.ReverseDocumentFiscalYear
                                                                      and _ReversalDocument.CompanyCode        = a.CompanyCode
{
       @ObjectModel.foreignKey.association: '_CompanyCode'
  key  a.CompanyCode,
  key  a.AccountingDocument,
       @ObjectModel.foreignKey.association: '_FiscalYear'
  key  a.FiscalYear,


       a.ReverseDocument,
       a.IsReversed,
       a.IsReversal,
       a.ReverseDocumentFiscalYear,


       a.AccountingDocumentCreationDate                                                        as AccountingDocumentCreationDate,
       a.CreationTime                                                                          as CreationTime,
       a.ReversalReason                                                                        as ReversalReason,


       a.AccountingDocumentCategory,

//       max( a._OperationalAcctgDocItem._JournalEntry._JournalEntryItem[ 1: LedgerGLLineItem  = '000001' ].FiscalPeriod ) as FiscalPeriod,

       a.FiscalPeriod,

       a.DocumentDate                                                                          as DocumentDate,

       a.PostingDate                                                                           as PostingDate,

       a.AccountingDocumentType,

       a.CompanyCodeCurrency,

       a.AccountingDocCreatedByUser                                                            as CreatedByUser, //SOURCEID 4.1.4.10,



       max( case
             when  _OperationalAcctgDocItem[ 1: FinancialAccountType = 'D'].Customer  is not null
              then _OperationalAcctgDocItem[ 1: FinancialAccountType = 'D'].Customer
             else ''
            end )                                                                              as Customer,

       max(a._OperationalAcctgDocItem[1: FinancialAccountType = 'D'].PaymentTerms)             as CustomerPaymentTerms,

       @DefaultAggregation: #SUM
       @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
       max(a._OperationalAcctgDocItem[1: FinancialAccountType = 'D' ].CashDiscountBaseAmount)  as CashDiscountBaseAmount,
       max(a._OperationalAcctgDocItem[1: FinancialAccountType = 'D' ].CashDiscount1Percent)    as CashDiscount1Percent,
       max(a._OperationalAcctgDocItem[1: FinancialAccountType = 'D' ].CashDiscount2Percent)    as CashDiscount2Percent,
       max(a._OperationalAcctgDocItem[1: FinancialAccountType = 'D' ].CashDiscount1DueDate)    as CashDiscount1DueDate,
       max(a._OperationalAcctgDocItem[1: FinancialAccountType = 'D' ].CashDiscount2DueDate )   as CashDiscount2DueDate,

       max(a._OperationalAcctgDocItem[FinancialAccountType = 'D' ].AccountingDocumentItem)     as AccountingDocumentItem,
       a.Currency                                                                              as TransactionCurrency,

       a.ExchangeRate                                                                          as ExchangeRate,

       @DefaultAggregation: #SUM
       @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
       max(a._OperationalAcctgDocItem[FinancialAccountType = 'D'].AmountInTransactionCurrency) as AmountInTransactionCurrency,

       @DefaultAggregation: #SUM
       @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
       max(a._OperationalAcctgDocItem[FinancialAccountType = 'D'].AmountInCompanyCodeCurrency) as AmountInCompanyCodeCurrency,

       max(a._OperationalAcctgDocItem[FinancialAccountType = 'D']._Customer.IsOneTimeAccount)  as IsOneTimeAccount,

       max(a._OperationalAcctgDocItem[FinancialAccountType = 'D'].DelivOfGoodsDestCountry)     as DelivOfGoodsDestCountry,

       max(a._OperationalAcctgDocItem[FinancialAccountType = 'D'].PaymentMethod)               as PaymentMethod,

       max(a._OperationalAcctgDocItem[FinancialAccountType = 'D'].SpecialGLCode)               as SpecialGLCode,

       max( case
            when a._OperationalAcctgDocItem[FinancialAccountType = 'D'].CashDiscountAmtInCoCodeCrcy is not null
             and a._OperationalAcctgDocItem[FinancialAccountType = 'D'].CashDiscountAmtInCoCodeCrcy is not initial

             then 'X'
             else ''
            end )                                                                              as InvoiceHasDiscountOnItem,

       a.ReferenceDocumentType,
       a.OriginalReferenceDocument,

       _Currency,
       _CompanyCodeCurrency,
       _TotalItems,
       _AccountingDocumentCategory,
       _CompanyCode,
       _AccountingDocumentType,
       _OperationalAcctgDocItem,
       _ReversalDocument,
       _RevReason,
       _FiscalYear

}
group by
  a.AccountingDocument,
  a.CompanyCode,
  a.FiscalYear,
  a.ReverseDocument,
  a.IsReversed,
  a.IsReversal,
  a.ReverseDocumentFiscalYear,
  a.AccountingDocumentCreationDate,
  a.CreationTime,
  a.ReversalReason,
  a.AccountingDocumentCategory,
  a.FiscalPeriod,
  a.DocumentDate,
  a.PostingDate,
  a.AccountingDocumentType,
  a.CompanyCodeCurrency,
  a.AccountingDocCreatedByUser,
  a.Currency,
  a.ExchangeRate,
  a.ReferenceDocumentType,
  a.OriginalReferenceDocument
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACCOUNTINGDOCUMENT",
"I_CUSTOMER",
"I_OPERATIONALACCTGDOCITEM"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENT",
"I_ACCOUNTINGDOCUMENTCATEGORY",
"I_ACCOUNTINGDOCUMENTTYPE",
"I_COMPANYCODE",
"I_CURRENCY",
"I_FISCALYEARFORCOMPANYCODE",
"I_OPERATIONALACCTGDOCITEM",
"I_REVERSALREASON",
"I_SAFTACCOUNTINGTAXCHECK"
],
"BASE":
[
"I_ACCOUNTINGDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/