@AbapCatalog.sqlViewName: 'CCOGSSPLRELGLI'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.allowExtensions: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel: {usageType: { sizeCategory: #M,
dataClass: #MIXED,
serviceQuality: #C } }
//@ObjectModel.query.implementedBy: 'ABAP:CL_FCO_COGS_EXPLAIN_QRY'
@VDM.viewType: #CONSUMPTION
@EndUserText.label: 'Relevant Items from COGS Split and Original Document'
@UI.headerInfo.description.value: 'COGSSplitGLItemRoleName'
@UI.headerInfo.title.type: 'STANDARD'
//@UI.headerInfo.title.label: 'picked up from '
@UI.headerInfo.title.value: 'JournalEntry'
//@UI.presentationVariant: [{
//qualifier: 'GroupBy',
//id: 'test',
//text: 'tgdtd',
//
// groupBy: ['ReferenceDocument'] }]
//fcoc_cogs_sa original items
define view C_COGSSplitRelevantGLItems
as select from I_GLAccountLineItem as A
inner join I_COGSSplitSourceAccount as COGS_Accounts on COGS_Accounts.COGSSplitSourceAccount = A.GLAccount
inner join I_Ledger on A.Ledger = I_Ledger.Ledger
and I_Ledger.ReferenceLedger = ' '
association [1..*] to I_COGSSplitGLItemRole as _ITEMROLE on _ITEMROLE.DomainValue is not null
// "association [1..*] to I_COGSSplitGLItemRoleText as _ITEMROLETEXT on $projection.COGSSplitGLItemRole = _ITEMROLETEXT.DomainValue
association [0..*] to I_GLAccountTextRawData as _GLAccountText on $projection.ChartOfAccounts = _GLAccountText.ChartOfAccounts
and $projection.GLAccount = _GLAccountText.GLAccount
association [1..1] to C_COGSSplitAndOriginalItem as _OriginalItem on $projection.Ledger = _OriginalItem.Ledger
and $projection.CompanyCode = _OriginalItem.CompanyCode
and $projection.FiscalYear = _OriginalItem.FiscalYear
and $projection.JournalEntry = _OriginalItem.JournalEntry
and $projection.JournalEntryItem = _OriginalItem.JournalEntryItem
and $projection.GLBusinessTransactionType = _OriginalItem.BusinessTransactionType
and $projection.ReferenceDocument = _OriginalItem.ReferenceDocument
and $projection.ReferenceDocumentItem = _OriginalItem.ReferenceDocumentItem
and $projection.ReferenceDocumentType = _OriginalItem.ReferenceDocumentType
and $projection.SourceReferenceDocument = _OriginalItem.SourceReferenceDocument
and $projection.SourceReferenceDocumentItem = _OriginalItem.SourceReferenceDocumentItem
and $projection.SourceReferenceDocumentType = _OriginalItem.SourceReferenceDocumentType
and $projection.PostingDate = _OriginalItem.PostingDate
-- Implemented in implementing class or $projection.AccountingDocumentCategory <> 'P' )
{
@UI.facet :
[{ id : 'SplitBasis',
purpose : #STANDARD,
type : #FIELDGROUP_REFERENCE,
label : 'Split Basis',
position : 10,
targetQualifier : 'SplitBasis' }]
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_Ledger' , element: 'Ledger' },
additionalBinding: [{ element: 'ReferenceLedger', localConstant: ' ', usage:#FILTER}]
}]
key A.Ledger,
@ObjectModel.text.element: ['CompanyCodeName']
key A.CompanyCode,
@UI.fieldGroup : [ { qualifier: 'SplitBasis' , position: 10 ,importance: #HIGH } ]
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_FiscalYearForVariant' , element: 'FiscalYear' }
}]
key A.FiscalYear,
key A.AccountingDocument as JournalEntry,
key cast( A.LedgerGLLineItem as fis_jeitm ) as JournalEntryItem,
// case when A.BusinessTransactionType <> 'TBCS' then A.AccountingDocument else B.AccountingDocument end as COGSSplitOriginalJournalEntry,
// case when A.BusinessTransactionType <> 'TBCS' then A.LedgerGLLineItem else B.LedgerGLLineItem end as COGSSplitOriginalJrnlEntryItem,
// case when B.AccountingDocument is not null then B.AccountingDocument when A.BusinessTransactionType = 'TBCS' then A.AccountingDocument end as COGSSplitJournalEntry,
@Consumption.filter.selectionType:#INTERVAL
A.PostingDate, //@UI.hidden
A.FiscalPeriod,
@ObjectModel.text.element: ['ProductName']
A.Product,
@ObjectModel.text.element: ['PlantName']
A.Plant,
// Hierarchies
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_CompanyCodeHierarchyVH', element: 'CompanyCodeHierarchy' } }]
@Consumption.filter.selectionType: #SINGLE
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_hryid_ccode_42) as CompanyCodeHierarchy,
@Consumption.filter.hidden: true
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_hrynid_ccode_50) as CompanyCodeHierarchyNode,
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_GLAccountHierarchyStdVH', element: 'GLAccountHierarchy' } }]
@Consumption.filter.selectionType: #SINGLE
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_glaccthier) as GLAccountHierarchy,
@Consumption.filter.hidden: true
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_glacct_hrynid_50) as GLAccountHierarchyNode,
_GLAccountText[1:Language = $session.system_language ].GLAccountName as GLAccountName,
@ObjectModel.text.element: ['GLAccountName']
A.GLAccount,
//A.GLAccountName,
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
A.AmountInCompanyCodeCurrency,
//@Semantics.unitOfMeasure:true
A.BaseUnit,
@Semantics.currencyCode: true
A.CompanyCodeCurrency,
@Semantics.amount.currencyCode: 'GlobalCurrency'
A.AmountInGlobalCurrency,
@Semantics.currencyCode: true
A.GlobalCurrency,
A.Quantity,
A.ReferenceDocument,
A.ReferenceDocumentItem,
A.ReferenceDocumentType,
A.SourceReferenceDocument,
A.SourceReferenceDocumentItem,
A.SourceReferenceDocumentType,
A.AccountingDocumentCategory,
@ObjectModel.text.element: ['BusinessTransactionTypeName']
A.BusinessTransactionType,
A.GLBusinessTransactionType,
@ObjectModel.foreignKey.association: '_SubLedgerAccLineItemType'
A.SubLedgerAcctLineItemType,
A._SubLedgerAccLineItemType,
A.SalesOrder,
A.SalesOrderItem,
case when A.GLBusinessTransactionType <> 'TBCS' then _ITEMROLE[1: DomainValue = 'ORIGINAL']._Text[1:Language = $session.system_language ].COGSSplitGLItemRoleName else
_ITEMROLE[1: DomainValue = 'SPLIT' ]._Text[1:Language = $session.system_language ].COGSSplitGLItemRoleName end as COGSSplitGLItemRoleName,
@ObjectModel.text.element: ['COGSSplitGLItemRoleName']
case when A.GLBusinessTransactionType <> 'TBCS' then _ITEMROLE[1: DomainValue = 'ORIGINAL'].COGSSplitGLItemRole else
_ITEMROLE[1: DomainValue = 'SPLIT' ].COGSSplitGLItemRole end as COGSSplitGLItemRole,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: false
@ObjectModel.sort.enabled: false
_OriginalItem,
@UI.hidden: true
A.ChartOfAccounts,
// _SplitBasis,
// _Calculation,
// _Messages,
// to_ValueHelp
// @Consumption.hidden
// @Consumption.filter.hidden: true
// @UI.hidden: true
// A._GLAccountTxt,
@Consumption.hidden
A.OrganizationDivision,
@Consumption.hidden
A._ServiceDocument,
@Consumption.hidden
A.SalesOrganization,
@Consumption.hidden
A._CurrentCostCenter,
@Consumption.hidden
A.DistributionChannel,
@Consumption.hidden
A.FinancialAccountType,
@Consumption.hidden
A.CostCenter,
@Consumption.hidden
A.ControllingArea,
@Consumption.hidden
A._CurrentProfitCenter,
@Consumption.hidden
A.BusinessArea,
@Consumption.hidden
A.FunctionalArea,
@Consumption.hidden
A.Segment,
@Consumption.hidden
A.ValuationArea,
@Consumption.hidden
A.AssetClass,
@Consumption.hidden
A._Order,
@Consumption.hidden
A.OrderID,
@Consumption.hidden
A._SalesDocument,
@Consumption.hidden
A.SalesDocument,
@Consumption.hidden
A.SalesDocumentItem,
@Consumption.hidden
A.ServiceDocumentType,
@Consumption.hidden
A._AccountingDocumentType,
@Consumption.hidden
A.AccountingDocumentType,
@Consumption.hidden
A.ProfitCenter,
@Consumption.hidden
A._GLAccountInCompanyCode,
@Consumption.hidden
A._Supplier,
@Consumption.hidden
A.Supplier,
@Consumption.hidden
A._Customer,
@Consumption.hidden
A.Customer,
@Consumption.hidden
A.ServiceDocument,
A._CompanyCode.CompanyCodeName,
A._Plant.PlantName,
A._BusinessTransactionType._Text[1:Language = $session.system_language ].BusinessTransactionTypeName,
A._Product._Text[1:Language = $session.system_language ].ProductName
}
where
A.GLBusinessTransactionType <> 'TBCS' and
A.JrnlEntryItemObsoleteReason = ' '
//group by
// A.Ledger,
// A.CompanyCode,
// A.FiscalYear,
// A.AccountingDocument,
// A.LedgerGLLineItem,
// A.BusinessTransactionType,
// // B.AccountingDocument,
// // B.LedgerGLLineItem,
// // B.AccountingDocument,
// A.PostingDate,
// A.FiscalPeriod,
// A.FiscalPeriod,
// A.Product,
// A.Plant,
// A.GLAccount,
// //A.GLAccountName,
// A.AmountInCompanyCodeCurrency,
// A.CompanyCodeCurrency,
// A.AmountInGlobalCurrency,
// A.GlobalCurrency,
// A.ReferenceDocument,
// A.ReferenceDocumentItem,
// A.ReferenceDocumentType,
// A.ReferenceDocumentType,
// A.BusinessTransactionType,
// A.SubLedgerAcctLineItemType
union all select from I_GLAccountLineItem as A
association [1..*] to I_COGSSplitGLItemRole as _ITEMROLE on _ITEMROLE.DomainValue is not null
association [0..*] to I_GLAccountTextRawData as _GLAccountText on $projection.ChartOfAccounts = _GLAccountText.ChartOfAccounts
and $projection.GLAccount = _GLAccountText.GLAccount
association [1..1] to C_COGSSplitAndOriginalItem as _OriginalItem on $projection.Ledger = _OriginalItem.Ledger
and $projection.CompanyCode = _OriginalItem.CompanyCode
and $projection.FiscalYear = _OriginalItem.FiscalYear
and $projection.JournalEntry = _OriginalItem.JournalEntry
and $projection.JournalEntryItem = _OriginalItem.JournalEntryItem
and $projection.GLBusinessTransactionType = _OriginalItem.BusinessTransactionType
and $projection.ReferenceDocument = _OriginalItem.ReferenceDocument
and $projection.ReferenceDocumentItem = _OriginalItem.ReferenceDocumentItem
and $projection.ReferenceDocumentType = _OriginalItem.ReferenceDocumentType
and $projection.SourceReferenceDocument = _OriginalItem.SourceReferenceDocument
and $projection.SourceReferenceDocumentItem = _OriginalItem.SourceReferenceDocumentItem
and $projection.SourceReferenceDocumentType = _OriginalItem.SourceReferenceDocumentType
and $projection.PostingDate = _OriginalItem.PostingDate
-- Implemented in implementing class or $projection.AccountingDocumentCategory <> 'P' ) or $projection.AccountingDocumentCategory <> 'P' )
{
@UI.facet :
[{ id : 'SplitBasis',
purpose : #STANDARD,
type : #FIELDGROUP_REFERENCE,
label : 'COGS Split Basis',
position : 10,
targetQualifier : 'SplitBasis' }]
key A.Ledger,
@ObjectModel.text.element: ['CompanyCodeName']
key A.CompanyCode,
@UI.fieldGroup : [ { qualifier: 'SplitBasis' , position: 10 ,importance: #HIGH } ]
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_FiscalYear' , element: 'FiscalYear' }
}]
key A.FiscalYear,
key A.AccountingDocument as JournalEntry,
key cast( A.LedgerGLLineItem as fis_jeitm ) as JournalEntryItem,
// case when A.BusinessTransactionType <> 'TBCS' then A.AccountingDocument else B.AccountingDocument end as COGSSplitOriginalJournalEntry,
// case when A.BusinessTransactionType <> 'TBCS' then A.LedgerGLLineItem else B.LedgerGLLineItem end as COGSSplitOriginalJrnlEntryItem,
// case when B.AccountingDocument is not null then B.AccountingDocument when A.BusinessTransactionType = 'TBCS' then A.AccountingDocument end as COGSSplitJournalEntry,
A.PostingDate, //@UI.hidden
A.FiscalPeriod,
@ObjectModel.text.element: ['ProductName']
A.Product,
@ObjectModel.text.element: ['PlantName']
A.Plant,
// Hierarchies
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_CompanyCodeHierarchyVH', element: 'CompanyCodeHierarchy' } }]
@Consumption.filter.selectionType: #SINGLE
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_hryid_ccode_42) as CompanyCodeHierarchy,
@Consumption.filter.hidden: true
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_hrynid_ccode_50) as CompanyCodeHierarchyNode,
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_GLAccountHierarchyStdVH', element: 'GLAccountHierarchy' } }]
@Consumption.filter.selectionType: #SINGLE
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_glaccthier) as GLAccountHierarchy,
@Consumption.filter.hidden: true
@ObjectModel.filter.transformedBy: 'ABAP:CL_FINS_HIER_VH_FLTR_TRANSFORM'
cast('' as fis_glacct_hrynid_50) as GLAccountHierarchyNode,
_GLAccountText[1:Language = $session.system_language ].GLAccountName as GLAccountName,
@ObjectModel.text.element: ['GLAccountName']
A.GLAccount,
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
A.AmountInCompanyCodeCurrency,
//@Semantics.unitOfMeasure:true
A.BaseUnit,
@Semantics.currencyCode: true
A.CompanyCodeCurrency,
@Semantics.amount.currencyCode: 'GlobalCurrency'
A.AmountInGlobalCurrency,
@Semantics.currencyCode: true
A.GlobalCurrency,
A.Quantity,
A.ReferenceDocument,
A.ReferenceDocumentItem,
A.ReferenceDocumentType,
A.SourceReferenceDocument,
A.SourceReferenceDocumentItem,
A.SourceReferenceDocumentType,
A.AccountingDocumentCategory,
@ObjectModel.text.element: ['BusinessTransactionTypeName']
A.BusinessTransactionType,
A.GLBusinessTransactionType,
@ObjectModel.foreignKey.association: '_SubLedgerAccLineItemType'
A.SubLedgerAcctLineItemType,
A._SubLedgerAccLineItemType,
A.SalesOrder,
A.SalesOrderItem,
case when A.GLBusinessTransactionType <> 'TBCS' then _ITEMROLE[1: DomainValue = 'ORIGINAL']._Text[1:Language = $session.system_language ].COGSSplitGLItemRoleName else
_ITEMROLE[1: DomainValue = 'SPLIT' ]._Text[1:Language = $session.system_language ].COGSSplitGLItemRoleName end as COGSSplitGLItemRoleName,
@ObjectModel.text.element: ['COGSSplitGLItemRoleName']
case when A.GLBusinessTransactionType <> 'TBCS' then _ITEMROLE[1: DomainValue = 'ORIGINAL'].COGSSplitGLItemRole else
_ITEMROLE[1: DomainValue = 'SPLIT' ].COGSSplitGLItemRole end as COGSSplitGLItemRole,
@Consumption.filter.hidden: true
@ObjectModel.filter.enabled: false
@ObjectModel.sort.enabled: false
_OriginalItem,
@UI.hidden: true
A.ChartOfAccounts,
// @Consumption.hidden
// @Consumption.filter.hidden: true
// @UI.hidden: true
// A._GLAccountTxt,
// _SplitBasis,
// _Calculation,
// _Messages,
// _ValueHelp
@Consumption.hidden
A.OrganizationDivision,
@Consumption.hidden
A._ServiceDocument,
@Consumption.hidden
A.SalesOrganization,
@Consumption.hidden
A._CurrentCostCenter,
@Consumption.hidden
A.DistributionChannel,
@Consumption.hidden
A.FinancialAccountType,
@Consumption.hidden
A.CostCenter,
@Consumption.hidden
A.ControllingArea,
@Consumption.hidden
A._CurrentProfitCenter,
@Consumption.hidden
A.BusinessArea,
@Consumption.hidden
A.FunctionalArea,
@Consumption.hidden
A.Segment,
@Consumption.hidden
A.ValuationArea,
@Consumption.hidden
A.AssetClass,
@Consumption.hidden
A._Order,
@Consumption.hidden
A.OrderID,
@Consumption.hidden
A._SalesDocument,
@Consumption.hidden
A.SalesDocument,
@Consumption.hidden
A.SalesDocumentItem,
@Consumption.hidden
ServiceDocumentType,
@Consumption.hidden
A._AccountingDocumentType,
@Consumption.hidden
A.AccountingDocumentType,
@Consumption.hidden
ProfitCenter,
@Consumption.hidden
A._GLAccountInCompanyCode,
@Consumption.hidden
A._Supplier,
@Consumption.hidden
A.Supplier,
@Consumption.hidden
A._Customer,
@Consumption.hidden
A.Customer,
@Consumption.hidden
A.ServiceDocument,
//A.WBSElement
A._CompanyCode.CompanyCodeName,
A._Plant.PlantName,
A._BusinessTransactionType._Text[1:Language = $session.system_language ].BusinessTransactionTypeName,
A._Product._Text[1:Language = $session.system_language ].ProductName
}
where
A.GLBusinessTransactionType = 'TBCS' and
A.JrnlEntryItemObsoleteReason = ' '
//group by
// A.Ledger,
// A.CompanyCode,
// A.FiscalYear,
// A.AccountingDocument,
// A.LedgerGLLineItem,
// A.BusinessTransactionType,
// // B.AccountingDocument,
// // B.LedgerGLLineItem,
// // B.AccountingDocument,
// A.PostingDate,
// A.FiscalPeriod,
// A.Product,
// A.Plant,
// A.GLAccount,
// //A.GLAccountName,
// A.AmountInCompanyCodeCurrency,
// A.CompanyCodeCurrency,
// A.AmountInGlobalCurrency,
// A.GlobalCurrency,
// A.ReferenceDocument,
// A.ReferenceDocumentItem,
// A.ReferenceDocumentType,
// A.BusinessTransactionType,
// A.SubLedgerAcctLineItemType,
// Original_Doc_Label.domvalue_l,
// Split_Doc_Label.domvalue_l
//A.COGSSplitGLItemRole
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BUSINESSTRANSACTIONTYPE",
"I_BUSTRANSACTIONTYPETEXT",
"I_COGSSPLITGLITEMROLE",
"I_COGSSPLITGLITEMROLETEXT",
"I_COGSSPLITSOURCEACCOUNT",
"I_COMPANYCODE",
"I_GLACCOUNTLINEITEM",
"I_GLACCOUNTTEXTRAWDATA",
"I_LEDGER",
"I_PLANT",
"I_PRODUCT",
"I_PRODUCTTEXT"
],
"ASSOCIATED":
[
"C_COGSSPLITANDORIGINALITEM",
"I_ACCOUNTINGDOCUMENTTYPE",
"I_COGSSPLITGLITEMROLE",
"I_COSTCENTER",
"I_CUSTOMER",
"I_GLACCOUNTINCOMPANYCODE",
"I_GLACCOUNTTEXTRAWDATA",
"I_ORDER",
"I_PROFITCENTER",
"I_SALESDOCUMENT",
"I_SRVCDOCBYDOCUMENTTYPE",
"I_SUBLEDGERACCLINEITEMTYPE",
"I_SUPPLIER"
],
"BASE":
[
"I_GLACCOUNTLINEITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/