I_SAFTGenLedgerCustomer

DDL: I_SAFTGENLEDGERCUSTOMER SQL: ISAFTGENLEDCUST Type: view COMPOSITE

SAF-T Gen Ledger Customer

I_SAFTGenLedgerCustomer is a Composite CDS View that provides data about "SAF-T Gen Ledger Customer" in SAP S/4HANA. It reads from 2 data sources (I_JournalEntryItem, P_SAFTGLMaxCustomer) and exposes 46 fields with key fields SourceLedger, CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem. It has 2 associations to related views.

Data Sources (2)

SourceAliasJoin Type
I_JournalEntryItem a from
P_SAFTGLMaxCustomer GLMaxCustomer inner

Associations (2)

CardinalityTargetAliasCondition
[0..*] I_SAFTCustTaxRegnNmbr _CustLand a.Customer = _CustLand.CustomerNum
[0..1] P_SAFT_CONTACTPERSON _ContactPerson a.Customer = _ContactPerson.Customer

Annotations (11)

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

Fields (46)

KeyFieldSource TableSource FieldDescription
KEY SourceLedger I_JournalEntryItem SourceLedger
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
ChartOfAccounts I_JournalEntryItem ChartOfAccounts
GLAccount I_JournalEntryItem GLAccount
AccountingDocumentCategory I_JournalEntryItem AccountingDocumentCategory
PostingDate I_JournalEntryItem PostingDate
Customer I_JournalEntryItem Customer
VATRegistrationendasVATRegistration
TaxNumber1
TaxNumber2
OrganizationBPName1
OrganizationBPName2
CityName
PostalCode
Country
IsOneTimeAccount
AddressID
CustomerNum
AuthorizationGroup
_StandardAddress
StreetName
StreetPrefixName
AdditionalStreetPrefixName
StreetSuffixName
AdditionalStreetSuffixName
HouseNumber
Region
ReconciliationAccount
PartnerFirstName _ContactPerson FirstName
PartnerLastName _ContactPerson LastName
DelivOfGoodsDestCountry
_CustLand _CustLand
_SourceLedger I_JournalEntryItem _SourceLedger
_CustomerCompany
_CompanyCode I_JournalEntryItem _CompanyCode
_FiscalYear I_JournalEntryItem _FiscalYear
_JournalEntry I_JournalEntryItem _JournalEntry
_Ledger I_JournalEntryItem _Ledger
_Customer _Customer
_ChartOfAccounts _ChartOfAccounts
_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts
_AccountingDocumentCategory _AccountingDocumentCategory
@AbapCatalog.sqlViewName: 'ISAFTGENLEDCUST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@EndUserText.label: 'SAF-T Gen Ledger Customer'
define view I_SAFTGenLedgerCustomer
  as select from I_JournalEntryItem as a
  
  inner join P_SAFTGLMaxCustomer as GLMaxCustomer on GLMaxCustomer.SourceLedger = a.SourceLedger
                                                 and GLMaxCustomer.CompanyCode = a.CompanyCode
                                                 and GLMaxCustomer.FiscalYear = a.FiscalYear
                                                 and GLMaxCustomer.AccountingDocument = a.AccountingDocument
                                                 and GLMaxCustomer.LedgerGLLineItem = a.LedgerGLLineItem
                                                 and GLMaxCustomer.Ledger = a.Ledger
                           
  association [0..*] to I_SAFTCustTaxRegnNmbr as _CustLand
                     on a.Customer = _CustLand.CustomerNum

  association [0..1] to P_SAFT_CONTACTPERSON as _ContactPerson 
                      on a.Customer = _ContactPerson.Customer
{
  @ObjectModel.foreignKey.association: '_SourceLedger'
  key a.SourceLedger                                   as SourceLedger,
  @ObjectModel.foreignKey.association: '_CompanyCode'
  key a.CompanyCode                                    as CompanyCode,
  @ObjectModel.foreignKey.association: '_FiscalYear'
  key a.FiscalYear                                     as FiscalYear,
  @ObjectModel.foreignKey.association: '_JournalEntry'
  key a.AccountingDocument                             as AccountingDocument,
  key a.LedgerGLLineItem                               as LedgerGLLineItem,
  @ObjectModel.foreignKey.association: '_Ledger'
  key a.Ledger                                         as Ledger,
  
  @ObjectModel.foreignKey.association: '_ChartOfAccounts'
  a.ChartOfAccounts,
  @ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
  a.GLAccount,
  
  @ObjectModel.foreignKey.association: '_AccountingDocumentCategory'
  a.AccountingDocumentCategory,
  
  a.PostingDate,
  @ObjectModel.foreignKey.association: '_Customer'
  a.Customer,                                                                                                
  
  case when a._JournalEntry._OperationalAcctgDocItem[ 1:FinancialAccountType = 'D' ].VATRegistration is not null
       then 
        case 
            when a._JournalEntry._OperationalAcctgDocItem[ 1:FinancialAccountType = 'D' ].VATRegistration is not initial
                then a._JournalEntry._OperationalAcctgDocItem[ 1:FinancialAccountType = 'D' ].VATRegistration
                else a._Customer.VATRegistration
            end
       else a._Customer.VATRegistration
  end as VATRegistration,
  
  a._Customer.TaxNumber1,
  a._Customer.TaxNumber2,
  a._Customer.OrganizationBPName1,
  a._Customer.OrganizationBPName2,
  a._Customer.CityName,
  a._Customer.PostalCode,
  a._Customer.Country,
  //a._Customer.StreetName,

  a._Customer.IsOneTimeAccount,
  a._Customer.AddressID,
  a._Customer.Customer                                 as CustomerNum,
  a._Customer.AuthorizationGroup,
  a._Customer._StandardAddress,
  
  a._Customer._StandardAddress.StreetName                                                  as StreetName,
  a._Customer._StandardAddress.StreetPrefixName                                            as StreetPrefixName,
  a._Customer._StandardAddress.AdditionalStreetPrefixName                                  as AdditionalStreetPrefixName,
  a._Customer._StandardAddress.StreetSuffixName                                            as StreetSuffixName,
  a._Customer._StandardAddress.AdditionalStreetSuffixName                                  as AdditionalStreetSuffixName,
  a._Customer._StandardAddress.HouseNumber                                                 as HouseNumber,
  
  a._Customer.Region,
  a._Customer._CustomerCompany[ 1:CompanyCode = a.CompanyCode ].ReconciliationAccount as ReconciliationAccount,
  
  _ContactPerson.FirstName                     as PartnerFirstName,
  _ContactPerson.LastName                      as PartnerLastName,
  
  
 substring ( a._JournalEntry._OperationalAcctgDocItem[ 1:FinancialAccountType = 'D' ].VATRegistration, 1, 2 ) as DelivOfGoodsDestCountry,
  
  _CustLand,
  a._SourceLedger,
  a._Customer._CustomerCompany,
  a._CompanyCode,
  a._FiscalYear,
  a._JournalEntry,
  a._Ledger,
  _Customer,
  _ChartOfAccounts,
  _GLAccountInChartOfAccounts,
  _AccountingDocumentCategory      
    
  
} where a.FinancialAccountType = 'D'
    and a._Customer.IsOneTimeAccount = ' '

/*
    group by
        a.SourceLedger,
        a.CompanyCode,
        a.FiscalYear,
        a.AccountingDocument,
        a.LedgerGLLineItem,
        a.Ledger,
        a.ChartOfAccounts,
        a.GLAccount,
        a.AccountingDocumentCategory,
        a.PostingDate,
        a.Customer,
        a._Customer.VATRegistration,
        a._Customer.TaxNumber1,
        a._Customer.TaxNumber2,
        a._Customer.OrganizationBPName1,
        a._Customer.OrganizationBPName2,
        a._Customer.CityName,
        a._Customer.PostalCode,
        a._Customer.Country,
        a._Customer.StreetName,
        a._Customer.IsOneTimeAccount,
        a._Customer.AddressID,
        a._Customer.Customer,
        a._Customer.AuthorizationGroup,
        a._Customer.Region,
        a._Customer._CustomerCompany.ReconciliationAccount,
        a._Customer._StandardAddress.StreetName,
        a._Customer._StandardAddress.StreetPrefixName,
        a._Customer._StandardAddress.AdditionalStreetPrefixName,
        a._Customer._StandardAddress.StreetSuffixName,
        a._Customer._StandardAddress.AdditionalStreetSuffixName,
        a._Customer._StandardAddress.HouseNumber

*/
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRESS",
"I_CUSTOMER",
"I_CUSTOMERCOMPANY",
"I_JOURNALENTRY",
"I_JOURNALENTRYITEM",
"I_OPERATIONALACCTGDOCITEM",
"P_SAFTGLMAXCUSTOMER",
"P_SAFT_CONTACTPERSON"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENTCATEGORY",
"I_ADDRESS",
"I_CHARTOFACCOUNTS",
"I_COMPANYCODE",
"I_CUSTOMER",
"I_CUSTOMERCOMPANY",
"I_FISCALYEARFORCOMPANYCODE",
"I_GLACCOUNTINCHARTOFACCOUNTS",
"I_JOURNALENTRY",
"I_LEDGER",
"I_SAFTCUSTTAXREGNNMBR",
"P_SAFT_CONTACTPERSON"
],
"BASE":
[
"I_CUSTOMER",
"I_JOURNALENTRYITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/