P_StRpTrialBalanceItem1

DDL: P_STRPTRIALBALANCEITEM1 SQL: PTRIALBALITEM1 Type: view COMPOSITE

P_StRpTrialBalanceItem1 is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_GLAccountLineItem, P_DistinctDatetoFiscalYear) and exposes 106 fields with key fields Ledger, CompanyCode, FiscalYear, SourceLedger, AccountingDocument.

Data Sources (2)

SourceAliasJoin Type
I_GLAccountLineItem I_GLAccountLineItem from
P_DistinctDatetoFiscalYear P_DistinctDatetoFiscalYear left_outer

Parameters (2)

NameTypeDefault
P_FromPostingDate fis_budat_from
P_ToPostingDate fis_budat_to

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName PTRIALBALITEM1 view
AbapCatalog.compiler.compareFilter true view
VDM.viewType #COMPOSITE view
VDM.private true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.dataClass #MIXED view

Fields (106)

KeyFieldSource TableSource FieldDescription
KEY Ledger Ledger
KEY CompanyCode CompanyCode
KEY FiscalYear I_GLAccountLineItem FiscalYear
KEY SourceLedger SourceLedger
KEY AccountingDocument AccountingDocument
KEY LedgerGLLineItem LedgerGLLineItem
AccountingDocumentItem AccountingDocumentItem
FiscalPeriod I_GLAccountLineItem FiscalPeriod
FiscalYearVariant FiscalYearVariant
LedgerFiscalYear LedgerFiscalYear
PostingDate PostingDate
DocumentDate DocumentDate
IsReversal IsReversal
IsReversed IsReversed
ProfitCenter ProfitCenter
FunctionalArea FunctionalArea
BusinessArea BusinessArea
ControllingArea ControllingArea
Segment Segment
ChartOfAccounts ChartOfAccounts
AlternativeGLAccount AlternativeGLAccount
CountryChartOfAccounts CountryChartOfAccounts
GLAccount GLAccount
ReconciliationAccountType _GLAccountInCompanyCode ReconciliationAccountType
Supplier Supplier
Customer Customer
FinancialAccountType FinancialAccountType
SpecialGLCode SpecialGLCode
AccountingDocumentType AccountingDocumentType
PostingKey PostingKey
AccountingDocumentCategory AccountingDocumentCategory
AccountingDocCreatedByUser AccountingDocCreatedByUser
DebitCreditCode DebitCreditCode
TaxCode TaxCode
char1endasCashJournalItemType
char1endasglo_item_typeasItemType
JrnlEntryItemMigrationSource JrnlEntryItemMigrationSource
OffsettingAccount OffsettingAccount
OffsettingAccountType OffsettingAccountType
CompanyCodeCurrency CompanyCodeCurrency
AmountInCompanyCodeCurrency AmountInCompanyCodeCurrency
TransactionCurrency TransactionCurrency
AmountInTransactionCurrency AmountInTransactionCurrency
BalanceTransactionCurrency BalanceTransactionCurrency
AmountInBalanceTransacCrcy AmountInBalanceTransacCrcy
GlobalCurrency GlobalCurrency
AmountInGlobalCurrency AmountInGlobalCurrency
FreeDefinedCurrency1 FreeDefinedCurrency1
AmountInFreeDefinedCurrency1 AmountInFreeDefinedCurrency1
FreeDefinedCurrency2 FreeDefinedCurrency2
AmountInFreeDefinedCurrency2 AmountInFreeDefinedCurrency2
FreeDefinedCurrency3 FreeDefinedCurrency3
AmountInFreeDefinedCurrency3 AmountInFreeDefinedCurrency3
FreeDefinedCurrency4 FreeDefinedCurrency4
AmountInFreeDefinedCurrency4 AmountInFreeDefinedCurrency4
FreeDefinedCurrency5 FreeDefinedCurrency5
AmountInFreeDefinedCurrency5 AmountInFreeDefinedCurrency5
FreeDefinedCurrency6 FreeDefinedCurrency6
AmountInFreeDefinedCurrency6 AmountInFreeDefinedCurrency6
FreeDefinedCurrency7 FreeDefinedCurrency7
AmountInFreeDefinedCurrency7 AmountInFreeDefinedCurrency7
FreeDefinedCurrency8 FreeDefinedCurrency8
AmountInFreeDefinedCurrency8 AmountInFreeDefinedCurrency8
AssignmentReference AssignmentReference
DocumentItemText DocumentItemText
ReferenceDocument ReferenceDocument
_Supplier _Supplier
_Customer _Customer
_GLAccountText _GLAccountText
_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts
_ProfitCenter _ProfitCenter
_FunctionalArea _FunctionalArea
_BusinessArea _BusinessArea
_Segment _Segment
_AlternativeGLAccount _AlternativeGLAccount
_ControllingArea _ControllingArea
_CountryChartOfAccounts _CountryChartOfAccounts
_ChartOfAccounts _ChartOfAccounts
_GLAccountInCompanyCode _GLAccountInCompanyCode
_Ledger _Ledger
_CompanyCode _CompanyCode
_AccountingDocumentType _AccountingDocumentType
_FiscalYear _FiscalYear
_SourceLedger _SourceLedger
_FiscalPeriodForVariant _FiscalPeriodForVariant
_FiscalYearVariant _FiscalYearVariant
_LedgerFiscalYearForVariant _LedgerFiscalYearForVariant
_FinancialAccountType _FinancialAccountType
_PostingKey _PostingKey
_SpecialGLCode _SpecialGLCode
_AccountingDocumentCategory _AccountingDocumentCategory
_DebitCreditCode _DebitCreditCode
_TaxCode _TaxCode
_CompanyCodeCurrency _CompanyCodeCurrency
_TransactionCurrency _TransactionCurrency
_BalanceTransactionCurrency _BalanceTransactionCurrency
_GlobalCurrency _GlobalCurrency
_FreeDefinedCurrency1 _FreeDefinedCurrency1
_FreeDefinedCurrency2 _FreeDefinedCurrency2
_FreeDefinedCurrency3 _FreeDefinedCurrency3
_FreeDefinedCurrency4 _FreeDefinedCurrency4
_FreeDefinedCurrency5 _FreeDefinedCurrency5
_FreeDefinedCurrency6 _FreeDefinedCurrency6
_FreeDefinedCurrency7 _FreeDefinedCurrency7
_FreeDefinedCurrency8 _FreeDefinedCurrency8
_JournalEntry _JournalEntry
@AbapCatalog.sqlViewName: 'PTRIALBALITEM1'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #COMPOSITE
@VDM.private: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.dataClass: #MIXED
define view P_StRpTrialBalanceItem1
  with parameters
    P_FromPostingDate : fis_budat_from,
    P_ToPostingDate   : fis_budat_to
  as select from    I_GLAccountLineItem
    left outer join P_DistinctDatetoFiscalYear( P_FromPostingDate: $parameters.P_FromPostingDate ) on I_GLAccountLineItem.FiscalYearVariant = P_DistinctDatetoFiscalYear.fiscal_year_variant
{

  key Ledger,
  key CompanyCode,
  key I_GLAccountLineItem.FiscalYear,
  key SourceLedger,
  key AccountingDocument,
  key LedgerGLLineItem,

      AccountingDocumentItem,
      @ObjectModel.foreignKey.association: '_FiscalPeriodForVariant'
      @Semantics.fiscal.period: true
      I_GLAccountLineItem.FiscalPeriod,
      FiscalYearVariant,
      LedgerFiscalYear,
      PostingDate,
      DocumentDate,
      IsReversal,
      IsReversed,
      ProfitCenter,
      FunctionalArea,
      BusinessArea,
      ControllingArea,
      Segment,
      ChartOfAccounts,
      AlternativeGLAccount,
      CountryChartOfAccounts,
      GLAccount,
      _GLAccountInCompanyCode.ReconciliationAccountType,
      Supplier,
      Customer,
      FinancialAccountType,
      SpecialGLCode,
      AccountingDocumentType,
      PostingKey,
      AccountingDocumentCategory,
      AccountingDocCreatedByUser,
      DebitCreditCode,
      TaxCode,

      case FinancialAccountType
         when 'K'
         then FinancialAccountType  //Supplier

         when 'D'
         then FinancialAccountType  //Customer

         when ' '
         then
           case _GLAccountInCompanyCode.ReconciliationAccountType
             when 'K'
             then _GLAccountInCompanyCode.ReconciliationAccountType  //Supplier

             when 'D'
             then _GLAccountInCompanyCode.ReconciliationAccountType  //Customer

             else cast( ' ' as abap.char(1))
           end
         else cast( ' ' as abap.char(1))
      end                     as CashJournalItemType,

      //ItemType

      // 1 - item relevant for both OperationalBalance and JournalItemBalance

      // 2 - item relevant for both JournalItemBalance only

      cast ( case AccountingDocumentItem //BSEG-BUZEI

        when '000' then
           case AccountingDocumentCategory //BSEG-BSTAT

             when 'C' then cast( '3' as abap.char(1))   // carry forward

             else cast( '2' as abap.char(1))
           end
        else cast( '1' as abap.char(1))
      end  as glo_item_type ) as ItemType,


     //CE2308 expose JrnlEntryItemMigrationSource

     //Requirement from MX

      JrnlEntryItemMigrationSource,

     //CE2402 expose  'OffsettingAccount' and 'OffsettingAccountType'

     //Requirement from BG

      OffsettingAccount,
      OffsettingAccountType,

      @Semantics.currencyCode:true
      CompanyCodeCurrency,
      @DefaultAggregation: #SUM
      @Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
      AmountInCompanyCodeCurrency,

      @Semantics.currencyCode:true
      TransactionCurrency,
      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      AmountInTransactionCurrency,

      @Semantics.currencyCode:true
      BalanceTransactionCurrency,
      @Semantics: { amount : {currencyCode: 'BalanceTransactionCurrency'} }
      AmountInBalanceTransacCrcy,

      @Semantics.currencyCode:true
      GlobalCurrency,
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      AmountInGlobalCurrency,

      @Semantics.currencyCode:true
      FreeDefinedCurrency1,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
      AmountInFreeDefinedCurrency1,

      @Semantics.currencyCode:true
      FreeDefinedCurrency2,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
      AmountInFreeDefinedCurrency2,

      @Semantics.currencyCode:true
      FreeDefinedCurrency3,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
      AmountInFreeDefinedCurrency3,

      @Semantics.currencyCode:true
      FreeDefinedCurrency4,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
      AmountInFreeDefinedCurrency4,

      @Semantics.currencyCode:true
      FreeDefinedCurrency5,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
      AmountInFreeDefinedCurrency5,

      @Semantics.currencyCode:true
      FreeDefinedCurrency6,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
      AmountInFreeDefinedCurrency6,

      @Semantics.currencyCode:true
      FreeDefinedCurrency7,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
      AmountInFreeDefinedCurrency7,

      @Semantics.currencyCode:true
      FreeDefinedCurrency8,
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
      AmountInFreeDefinedCurrency8,

      AssignmentReference,
      DocumentItemText,

      //CE2402 GR Requirement

      ReferenceDocument,

      _Supplier,
      _Customer,
      _GLAccountText,
      _GLAccountInChartOfAccounts,
      _ProfitCenter,
      _FunctionalArea,
      _BusinessArea,
      _Segment,
      _AlternativeGLAccount,
      _ControllingArea,
      _CountryChartOfAccounts,
      _ChartOfAccounts,
      _GLAccountInCompanyCode,
      _Ledger,
      _CompanyCode,
      _AccountingDocumentType,
      _FiscalYear,
      _SourceLedger,
      //_JournalEntry,

      _FiscalPeriodForVariant,
      _FiscalYearVariant,
      _LedgerFiscalYearForVariant,
      _FinancialAccountType,
      _PostingKey,
      _SpecialGLCode,
      _AccountingDocumentCategory,
      _DebitCreditCode,
      _TaxCode,
      _CompanyCodeCurrency,
      _TransactionCurrency,
      _BalanceTransactionCurrency,
      _GlobalCurrency,
      _FreeDefinedCurrency1,
      _FreeDefinedCurrency2,
      _FreeDefinedCurrency3,
      _FreeDefinedCurrency4,
      _FreeDefinedCurrency5,
      _FreeDefinedCurrency6,
      _FreeDefinedCurrency7,
      _FreeDefinedCurrency8,
       //CE2402 GR Requirement

      _JournalEntry
}
where
          I_GLAccountLineItem.LedgerFiscalYear   >= P_DistinctDatetoFiscalYear.fiscal_year
  and     PostingDate                            <= $parameters.P_ToPostingDate
  and(
    (
          I_GLAccountLineItem.FiscalPeriod       =  '000'
      and I_GLAccountLineItem.LedgerFiscalYear   =  P_DistinctDatetoFiscalYear.fiscal_year
    )
    or(
          I_GLAccountLineItem.FiscalPeriod       != '000'
    )
  )