P_BG_SAFTCUSTACCTBAL

CDS View

Customer GL Account Balance

P_BG_SAFTCUSTACCTBAL is a CDS View in S/4HANA. Customer GL Account Balance. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_BG_SAFTCustomer view_entity inner CONSUMPTION Customer Data for BG SAFT
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@VDM.private:true
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
  serviceQuality: #X,
  sizeCategory: #S,
  dataClass: #MIXED
}
define view entity P_BG_SAFTCustAcctBal
  with parameters
    P_FromPostingDate            : dats,
    P_ToPostingDate              : dats,
    P_FiscalYear                 : gjahr,
    P_AlternativeGLAccountIsUsed : saft_bg_alt_gl_account_flag

  as select from           P_BG_SAFTCustAcctBalEnd ( P_ToPostingDate: $parameters.P_ToPostingDate,
                                                    P_FiscalYear: $parameters.P_FiscalYear,
                                                    P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed) as end_bal

    inner join P_BG_SAFTCustAcctBalMvt( P_FromPostingDate: $parameters.P_FromPostingDate ,
                                                P_ToPostingDate: $parameters.P_ToPostingDate,
                                                P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed )    as bal_mov    on  bal_mov.SourceLedger    = end_bal.SourceLedger
                                                                                                                                          and bal_mov.Ledger          = end_bal.Ledger
                                                                                                                                          and bal_mov.CompanyCode     = end_bal.CompanyCode
                                                                                                                                          and bal_mov.GLAccount       = end_bal.GLAccount
                                                                                                                                          and bal_mov.ChartOfAccounts = end_bal.ChartOfAccounts
                                                                                                                                          and bal_mov.FiscalYear      = end_bal.FiscalYear
                                                                                                                                          and bal_mov.Customer        = end_bal.Customer
                                                                                                                                          and bal_mov.VATRegistration = end_bal.VATRegistration

{
  key end_bal.SourceLedger,
  key end_bal.Ledger,
  key end_bal.CompanyCode,
  key end_bal.Customer,
  key end_bal.GLAccount,
  key end_bal.ChartOfAccounts,
  key end_bal.FiscalYear,
  key end_bal.VATRegistration,

      end_bal.ActiveChartOfAccounts,

      end_bal.ActiveGLAccount,      
      
      end_bal.ReportingCurrency,
      @Semantics: { amount : {currencyCode: 'ReportingCurrency'} }
      cast(case
        when bal_mov.DebitAmountInReportingCurrency is not null and bal_mov.CreditAmountInReportingCrcy is not null
          then ((end_bal.DebitAmountInReportingCurrency + end_bal.CreditAmountInReportingCrcy)-(bal_mov.DebitAmountInReportingCurrency + bal_mov.CreditAmountInReportingCrcy))
        else (end_bal.DebitAmountInReportingCurrency + end_bal.CreditAmountInReportingCrcy)
      end as abap.curr(23,2) )                                                       as StartingBalanceAmtInRptgCrcy,

      @Semantics: { amount : {currencyCode: 'ReportingCurrency'} }
      (end_bal.DebitAmountInReportingCurrency + end_bal.CreditAmountInReportingCrcy) as EndingBalanceAmtInRptgCrcy,
      bal_mov.NumberOfItems
}