@AbapCatalog.sqlViewName: 'AFIOPENBALANCE'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #COMPOSITE
@VDM.lifecycle.contract.type: #PUBLIC_REMOTE_API
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'API Opening Balance'
@AccessControl.personalData.blocking: #('TRANSACTIONAL_DATA')
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations:true
@AccessControl.privilegedAssociations: [ '_CompanyCode', '_CurrentCostCenter', '_CurrentProfitCenter' ]
define view A_OpeningBalance
as select from I_GLAccountLineItemCube
association [1..1] to A_CompanyCode as _CompanyCode on $projection.CompanyCode = _CompanyCode.CompanyCode
association [0..1] to A_CostCenter as _CurrentCostCenter on $projection.ControllingArea = _CurrentCostCenter.ControllingArea
and $projection.CostCenter = _CurrentCostCenter.CostCenter
and _CurrentCostCenter.ValidityStartDate <= $session.system_date
and _CurrentCostCenter.ValidityEndDate >= $session.system_date
association [0..1] to A_ProfitCenter as _CurrentProfitCenter on $projection.ControllingArea = _CurrentProfitCenter.ControllingArea
and $projection.ProfitCenter = _CurrentProfitCenter.ProfitCenter
and _CurrentProfitCenter.ValidityStartDate <= $session.system_date
and _CurrentProfitCenter.ValidityEndDate >= $session.system_date
association [0..1] to A_GLAccountInChartOfAccounts as _GLAccountInChartOfAccounts
on $projection.ChartOfAccounts = _GLAccountInChartOfAccounts.ChartOfAccounts
and $projection.GLAccount = _GLAccountInChartOfAccounts.GLAccount
{
//@ObjectModel.foreignKey.association: '_Ledger'
Ledger, //RLDNR
//LedgerName,
_Ledger._Text[1:Language = $session.system_language].LedgerName,
//@ObjectModel.foreignKey.association: '_LedgerFiscalYear'
LedgerFiscalYear, //RYEAR
//@ObjectModel.foreignKey.association: '_ControllingArea'
ControllingArea, //KOKRS
//ControllingAreaName,
_ControllingArea.ControllingAreaName,
//@ObjectModel.foreignKey.association: '_CompanyCode'
CompanyCode, //RBUKRS
//CompanyCodeName,
_CompanyCode.CompanyCodeName,
//@ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
GLAccount, //RACCT
//GLAccountName,
//_GLAccountInChartOfAccounts._Text[1:Language = $parameters.P_Language].GLAccountName,
///////////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_00 Unified Journal Entry: Transaction, Currencies, Units
///////////////////////////////////////////////////////////////////////////////
//@ObjectModel.foreignKey.association: '_FinancialTransactionType'
//FinancialTransactionType,
//@ObjectModel.foreignKey.association: '_BusinessTransactionType'
//BusinessTransactionType,
//@ObjectModel.foreignKey.association: '_ReferenceDocumentType'
//ReferenceDocumentType,
//ReferenceDocumentContext,
//ReferenceDocument,
//ReferenceDocumentItem,
//ReferenceDocumentItemGroup,
////////////////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_GL_ACCAS Unified Journal Entry: G/L additional account assignments
////////////////////////////////////////////////////////////////////////////////////
//@ObjectModel.foreignKey.association: '_CostCenter'
CostCenter, //RCNTR
//CostCenterName,
_CostCenter[1:ValidityEndDate >= $session.system_date and
ValidityStartDate <= $session.system_date]._Text[1:Language = $session.system_language].CostCenterName,
//@ObjectModel.foreignKey.association: '_ProfitCenter'
ProfitCenter, //PRCTR
//ProfitCenterName,
_ProfitCenter[1:ValidityEndDate >= $session.system_date and
ValidityStartDate <= $session.system_date]._Text[1:Language = $session.system_language].ProfitCenterName,
//@ObjectModel.foreignKey.association: '_FunctionalArea'
FunctionalArea, //RFAREA
//FunctionalAreaName,
_FunctionalArea._Text[1:Language = $session.system_language].FunctionalAreaName,
//@ObjectModel.foreignKey.association: '_BusinessArea'
BusinessArea, //RBUSA
//BusinessAreaName,
_BusinessArea._Text[1:Language = $session.system_language].BusinessAreaName,
//@ObjectModel.foreignKey.association: '_Segment'
Segment, //SEGMENT
//SegmentName,
_Segment._Text[1:Language = $session.system_language].SegmentName,
//@ObjectModel.foreignKey.association: '_PartnerCostCenter'
PartnerCostCenter, //SCNTR
//PartnerCostCenterName,
//_PartnerCostCenter._Text[1:Language = $parameters.P_Language].PartnerCostCenterName,
//@ObjectModel.foreignKey.association: '_PartnerProfitCenter'
PartnerProfitCenter, //PPRCTR
//PartnerProfitCenterName,
//_PartnerProfitCenter._Text[1:Language = $parameters.P_Language].PartnerProfitCenterName,
//@ObjectModel.foreignKey.association: '_PartnerFunctionalArea'
PartnerFunctionalArea, //SFAREA
//PartnerFunctionalAreaName,
//_PartnerFunctionalArea._Text[1:Language = $parameters.P_Language].PartnerFunctionalAreaName,
//@ObjectModel.foreignKey.association: '_PartnerBusinessArea'
PartnerBusinessArea, //SBUSA
//PartnerBusinessAreaName,
_PartnerBusinessArea._Text[1:Language = $session.system_language].BusinessAreaName as PartnerBusinessAreaName,
//@ObjectModel.foreignKey.association: '_PartnerCompany'
PartnerCompany, //RASSC
//PartnerCompanyName,
//_PartnerCompany._Text[1:Language = $parameters.P_Language].PartnerCompanyName,
//@ObjectModel.foreignKey.association: '_PartnerSegment'
PartnerSegment, //PSEGMENT
//PartnerSegmentName,
//_PartnerSegment._Text[1:Language = $parameters.P_Language].PartnerSegmentName,
/////////////////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_VALUE_DATA Unified Journal Entry: Value Fields
/////////////////////////////////////////////////////////////////////////////////////
//@ObjectModel.foreignKey.association: '_TransactionCurrency'
@Semantics.currencyCode:true
TransactionCurrency, //RWCUR
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'TransactionCurrency'} } AmountInTransactionCurrency, //WSL
//@ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
@Semantics.currencyCode:true
CompanyCodeCurrency, //RHCUR
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} } AmountInCompanyCodeCurrency, //HSL
//@ObjectModel.foreignKey.association: '_GlobalCurrency'
@Semantics.currencyCode:true
GlobalCurrency, //RKCUR
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'GlobalCurrency'} } AmountInGlobalCurrency, //KSL
//@ObjectModel.foreignKey.association: '_CostSourceUnit'
@Semantics.unitOfMeasure:true
CostSourceUnit, //RVUNIT
@Aggregation.default: #SUM
@Semantics: { quantity : {unitOfMeasure: 'CostSourceUnit'} } ValuationQuantity,
/////////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_FIX Unified Journal Entry: Mandatory fields for G/L
////////////////////////////////////////////////////////////////////////////
//@ObjectModel.foreignKey.association: '_FiscalPeriod'
'001' as FiscalPeriod, //POPER
//@ObjectModel.foreignKey.association: '_FiscalYearVariant'
FiscalYearVariant, //PERIV
//@ObjectModel.foreignKey.association: '_FiscalYearPeriod'
//FiscalYearPeriod, //FISCYEARPER
cast( cast(concat(LedgerFiscalYear, '001') as abap.char(7)) as fis_jahrper_c preserving type ) as FiscalYearPeriod,
//@ObjectModel.foreignKey.association: '_ChartOfAccounts'
ChartOfAccounts, //KTOPL
//@ObjectModel.foreignKey.association: '_AccountingDocumentType'
//AccountingDocumentType,
//_AccountingDocumentType._Text[1: Language = $session.system_language].AccountingDocumentTypeName as AccountingDocumentTypeName,
//AccountingDocumentItem,
//@ObjectModel.foreignKey.association: '_GLAccountType'
//GLAccountType,
///////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_GEN Unified Journal Entry: Fields for several subledgers
//////////////////////////////////////////////////////////////////////////
//@ObjectModel.foreignKey.association: '_SalesOrder'
//SalesOrder,
//@ObjectModel.foreignKey.association: '_SalesOrderItem'
//SalesOrderItem,
//@ObjectModel.foreignKey.association: '_Material'
//Material,
//@ObjectModel.foreignKey.association: '_Plant'
Plant, //WERKS
//PlantName,
//_Plant._Text[1:Language = $parameters.P_Language].PlantName,
//@ObjectModel.foreignKey.association: '_Customer'
Customer, //KUNNR
//CustomerName,
//_Customer._Text[1:Language = $parameters.P_Language].CustomerName,
//ServicesRenderedDate,
/////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_FI Unified Journal Entry: Fields for FI subledgers
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_FAA Unified Journal Entry: Fields for Asset Accounting
/////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_ML Unified Journal Entry: Fields for Material Ledger
//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_CFIN Unified Journal Entry: Fields for Central Finance
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_CO Unified Journal Entry: CO fields
///////////////////////////////////////////////////////////////////////////
ControllingDebitCreditCode, //CO_BELKZ
//@ObjectModel.foreignKey.association: '_Project'
Project, //PS_PSPID
@Semantics.text: true
_Project.ProjectDescription,
//@ObjectModel.foreignKey.association: '_WBSElement'
WBSElement, //PS_POSID
@Semantics.text: true
_WBSElement.WBSDescription as WBSElementDescription,
//@ObjectModel.foreignKey.association: '_PartnerCompanyCode'
PartnerCompanyCode, //PBUKRS
//PartnerCompanyCodeName,
_PartnerCompanyCode.CompanyCodeName as PartnerCompanyCodeName,
//@ObjectModel.foreignKey.association: '_CostCtrActivityType'
CostCtrActivityType, //LSTAR
//CostCtrActivityTypeName,
_CostCtrActivityType[1:ValidityEndDate >= $session.system_date and
ValidityStartDate <= $session.system_date]._Text[1:Language = $session.system_language].CostCtrActivityTypeName,
//@ObjectModel.foreignKey.association: '_InternalOrder'
OrderID, //AUFNR
//@ObjectModel.foreignKey.association: '_PartnerOrder_2'
PartnerOrder_2 as PartnerOrder, //PAUFNR
//@ObjectModel.foreignKey.association: '_PartnerCostCtrActivityType'
PartnerCostCtrActivityType, //PLSTAR
//PartnerCostCtrActivityTypeName,
_PartnerCostCtrActivityType[1:ValidityEndDate >= $session.system_date and
ValidityStartDate <= $session.system_date]._Text[1:Language = $session.system_language].CostCtrActivityTypeName as PartnerCostCtrActivityTypeName,
//@ObjectModel.foreignKey.association: '_PartnerProject'
PartnerProject, //PPS_PSPID
_PartnerProject.ProjectDescription as PartnerProjectDescription,
//@ObjectModel.foreignKey.association: '_PartnerWBSElement'
PartnerWBSElement, //PPS_POSID
@Semantics.text: true
_PartnerWBSElement.WBSDescription as PartnerWBSElementDescription,
//@ObjectModel.foreignKey.association: '_CostAnalysisResource'
//CostAnalysisResource,
//@ObjectModel.foreignKey.association: '_WorkPackageWorkItem'
//WorkItem,
//////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_COPA Unified Journal Entry: CO-PA fields
//////////////////////////////////////////////////////////////////////
//@ObjectModel.foreignKey.association: '_BillingDocumentType'
//BillingDocumentType,
//@ObjectModel.foreignKey.association: '_SalesOrganization'
SalesOrganization, //VKORG
//SalesOrganizationName,
_SalesOrganization._Text[1:Language = $session.system_language].SalesOrganizationName,
//@ObjectModel.foreignKey.association: '_DistributionChannel'
DistributionChannel, //VTWEG
//DistributionChannelName,
_DistributionChannel._Text[1:Language = $session.system_language].DistributionChannelName,
//@ObjectModel.foreignKey.association: '_Division'
OrganizationDivision, //SPART
//DivisionName,
//_Division._Text[1:Language = $parameters.P_Language].DivisionName,
//@ObjectModel.foreignKey.association: '_SoldMaterial'
SoldMaterial, //MATNR_COPA
//SoldMaterialName,
_SoldMaterial._Text[1:Language = $session.system_language].MaterialName as SoldMaterialName,
//@ObjectModel.foreignKey.association: '_MaterialGroup'
MaterialGroup, //MATKL
//MaterialGroupName,
_MaterialGroup._Text[1:Language = $session.system_language].MaterialGroupName,
//@ObjectModel.foreignKey.association: '_CustomerGroup'
CustomerGroup, //KDGRP
//CustomerGroupName,
_CustomerGroup._Text[1:Language = $session.system_language].CustomerGroupName,
//@ObjectModel.foreignKey.association: '_CustomerSupplierCountry'
CustomerSupplierCountry, //LAND1
//CustomerSupplierCountryName,
_CustomerSupplierCountry._Text[1:Language = $session.system_language].CountryName as CustomerSupplierCountryName,
//@ObjectModel.foreignKey.association: '_CustomerSupplierIndustry'
CustomerSupplierIndustry, //BRSCH
//CustomerSupplierIndustryName,
//_CustomerSupplierIndustry._Text[1:Language = $parameters.P_Language].SupplierIndustryName as CustomerSupplierIndustryName,
//@ObjectModel.foreignKey.association: '_SalesDistrict'
SalesDistrict, //BZIRK
//SalesDistrictName,
_SalesDistrict._Text[1:Language = $session.system_language].SalesDistrictName,
//////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_PS Unified Journal Entry: Fields for Public Sector
/////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_JVA Unified Journal Entry: Fields for Joint Venture Accounting
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// .INCLUDE ACDOC_SI_RE STRU 0 0 Unified Journal Entry: Fields for Real Estate
///////////////////////////////////////////////////////////////////////
_CompanyCode,
//_FiscalPeriod,
//_FiscalYearPeriod,
//_LedgerFiscalYear,
//_FiscalYearVariant,
//_ControllingArea,
//_TransactionCurrency,
//_CompanyCodeCurrency,
//_GlobalCurrency,
//_CostSourceUnit,
//_Segment,
_CurrentProfitCenter,
_CurrentCostCenter,
//_WBSElement,
//_Project,
//_BusinessArea,
//_FunctionalArea,
_GLAccountInChartOfAccounts
//_ChartOfAccounts,
//_Plant,
//_Ledger,
//_Division,
//_Customer,
//_CustomerGroup,
//_CustomerSupplierCountry,
//_MaterialGroup,
//_InternalOrder,
//_PartnerCostCenter,
//_PartnerProfitCenter,
//_PartnerBusinessArea,
//_PartnerFunctionalArea,
//_PartnerCompanyCode,
//_PartnerSegment,
//_PartnerCompany,
//_CostCtrActivityType,
//_PartnerCostCtrActivityType,
//_PartnerOrder_2,
//_PartnerWBSElement,
//_PartnerProject,
//_SalesOrganization,
//_DistributionChannel,
//_SalesDistrict,
//_SoldMaterial
}
where ( FiscalPeriod = '000' ) and
( AccountingDocumentCategory <> 'J' ) // AccountingDocumentCategory = bstat = 'J' (I_JournalEntryItem)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"A_COMPANYCODE",
"I_BUSINESSAREA",
"I_BUSINESSAREATEXT",
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_COSTCENTER",
"I_COSTCENTERACTIVITYTYPE",
"I_COSTCENTERACTIVITYTYPETEXT",
"I_COSTCENTERTEXT",
"I_COUNTRY",
"I_COUNTRYTEXT",
"I_CUSTOMERGROUP",
"I_CUSTOMERGROUPTEXT",
"I_DISTRIBUTIONCHANNEL",
"I_DISTRIBUTIONCHANNELTEXT",
"I_FUNCTIONALAREA",
"I_FUNCTIONALAREATEXT",
"I_GLACCOUNTLINEITEMCUBE",
"I_LEDGER",
"I_LEDGERTEXT",
"I_MATERIAL",
"I_MATERIALGROUP",
"I_MATERIALGROUPTEXT",
"I_MATERIALTEXT",
"I_PROFITCENTER",
"I_PROFITCENTERTEXT",
"I_PROJECT",
"I_SALESDISTRICT",
"I_SALESDISTRICTTEXT",
"I_SALESORGANIZATION",
"I_SALESORGANIZATIONTEXT",
"I_SEGMENT",
"I_SEGMENTTEXT",
"I_WBSELEMENT"
],
"ASSOCIATED":
[
"A_COMPANYCODE",
"A_COSTCENTER",
"A_GLACCOUNTINCHARTOFACCOUNTS",
"A_PROFITCENTER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/