C_ClearingDocument

DDL: C_CLEARINGDOCUMENT SQL: CCLRGDOC Type: view CONSUMPTION

Clearing Document

C_ClearingDocument is a Consumption CDS View that provides data about "Clearing Document" in SAP S/4HANA. It reads from 1 data source (P_ClearingDocument) and exposes 23 fields with key fields ClearingJournalEntry, CompanyCode, ClearingJournalEntryFiscalYear, IntercompanyTransaction. It has 4 associations to related views.

Data Sources (1)

SourceAliasJoin Type
P_ClearingDocument P_ClearingDocument from

Associations (4)

CardinalityTargetAliasCondition
[1..*] C_ClearedItem _ClearedItem ( $projection.IntercompanyTransaction <> '' and $projection.IntercompanyTransaction = _ClearedItem.IntercompanyTransaction ) or ( $projection.IntercompanyTransaction = '' and $projection.CompanyCode = _ClearedItem.CompanyCode and $projection.ClearingJournalEntry = _ClearedItem.ClearingJournalEntry and $projection.ClearingJournalEntryFiscalYear = _ClearedItem.ClearingJournalEntryFiscalYear )
[1..*] C_ClearedAccount _ClearedAccount ( $projection.IntercompanyTransaction <> '' and $projection.IntercompanyTransaction = _ClearedAccount.IntercompanyTransaction ) or ( $projection.IntercompanyTransaction = '' and $projection.CompanyCode = _ClearedAccount.CompanyCode and $projection.ClearingJournalEntry = _ClearedAccount.ClearingJournalEntry and $projection.ClearingJournalEntryFiscalYear = _ClearedAccount.ClearingJournalEntryFiscalYear )
[1..*] C_AccountingDocument _AccountingDocumentHeader ( $projection.IntercompanyTransaction <> '' and $projection.IntercompanyTransaction = _AccountingDocumentHeader.IntercompanyTransaction ) or ( $projection.IntercompanyTransaction = '' and $projection.CompanyCode = _AccountingDocumentHeader.CompanyCode and $projection.ClearingJournalEntry = _AccountingDocumentHeader.AccountingDocument and $projection.ClearingJournalEntryFiscalYear = _AccountingDocumentHeader.FiscalYear )
[0..*] C_ClearedItemCorrespondence _ClearedItemCorrespondence ( $projection.IntercompanyTransaction <> '' and $projection.IntercompanyTransaction = _ClearedItemCorrespondence.IntercompanyTransaction ) or ( $projection.IntercompanyTransaction = '' and $projection.CompanyCode = _ClearedItemCorrespondence.CompanyCode and $projection.ClearingJournalEntry = _ClearedItemCorrespondence.ClearingJournalEntry and $projection.ClearingJournalEntryFiscalYear = _ClearedItemCorrespondence.ClearingJournalEntryFiscalYear )

Annotations (17)

NameValueLevelField
AbapCatalog.sqlViewName CCLRGDOC view
AbapCatalog.compiler.compareFilter true view
VDM.viewType #CONSUMPTION view
EndUserText.label Clearing Document view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
Metadata.ignorePropagatedAnnotations true view
ClientHandling.algorithm #SESSION_VARIABLE view
UI.headerInfo.typeName Clearing Entry view
UI.headerInfo.typeNamePlural Clearing Entries view
UI.headerInfo.title.type #STANDARD view
UI.headerInfo.title.value ClearingJournalEntry view
UI.headerInfo.description.type #STANDARD view
UI.headerInfo.description.value PostingDate view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view

Fields (23)

KeyFieldSource TableSource FieldDescription
KEY ClearingJournalEntry P_ClearingDocument ClearingJournalEntry
KEY CompanyCode P_ClearingDocument CompanyCode
KEY ClearingJournalEntryFiscalYear P_ClearingDocument ClearingJournalEntryFiscalYear
KEY IntercompanyTransaction P_ClearingDocument IntercompanyTransaction
ClearingFiscalPeriod P_ClearingDocument ClearingFiscalPeriod
PostingDate P_ClearingDocument PostingDate
DocumentDate P_ClearingDocument DocumentDate
ClearingCreationDate P_ClearingDocument ClearingCreationDate
AccountingDocCreatedByUser P_ClearingDocument AccountingDocCreatedByUser
CompanyCodeCurrency P_ClearingDocument CompanyCodeCurrency
ClearingAccountingDocument
ClearingDocFiscalYear
AccountingDocumentType P_ClearingDocument AccountingDocumentType
AuthorizationGroup P_ClearingDocument AuthorizationGroup
UxFcClearingIsResettable 0
UxFcClearingIsReversible 0
UxFcTaxReportingDate 0
UxFcDocumentDate 0
_AccountingDocumentHeader _AccountingDocumentHeader
_ClearedItem _ClearedItem
_ClearedAccount _ClearedAccount
_ClearedItemCorrespondence _ClearedItemCorrespondence
_CompanyCode _CompanyCode
@AbapCatalog.sqlViewName: 'CCLRGDOC'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #CONSUMPTION
@EndUserText.label: 'Clearing Document'
@AccessControl.authorizationCheck: #CHECK
// ILM: BSEG et.al. belong to archiving object FI_DOCUMNT (deletion available according to SEC-12)

@AccessControl.personalData.blocking:#BLOCKED_DATA_EXCLUDED
@AccessControl.privilegedAssociations: [ '_ClearedItem', 
                                         '_ClearedAccount', 
                                         '_AccountingDocumentHeader', 
                                         '_ClearedItemCorrespondence' ]
@Metadata.ignorePropagatedAnnotations: true
@ClientHandling.algorithm: #SESSION_VARIABLE

@UI.headerInfo:{
  typeName: 'Clearing Entry',
  typeNamePlural: 'Clearing Entries',
  title: { type: #STANDARD, value: 'ClearingJournalEntry' },
  description: { type: #STANDARD, value: 'PostingDate'} }

@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED


define view C_ClearingDocument
  as select from P_ClearingDocument

  association [1..*] to C_ClearedItem    as _ClearedItem
                                         on (    $projection.IntercompanyTransaction        <> ''
                                             and $projection.IntercompanyTransaction        =  _ClearedItem.IntercompanyTransaction )
                                         or
                                            (    $projection.IntercompanyTransaction        =  ''
                                             and $projection.CompanyCode                    =  _ClearedItem.CompanyCode
                                             and $projection.ClearingJournalEntry           =  _ClearedItem.ClearingJournalEntry
                                             and $projection.ClearingJournalEntryFiscalYear =  _ClearedItem.ClearingJournalEntryFiscalYear )

  association [1..*] to C_ClearedAccount as _ClearedAccount
                                         on (    $projection.IntercompanyTransaction        <> ''
                                             and $projection.IntercompanyTransaction        =  _ClearedAccount.IntercompanyTransaction )
                                         or
                                            (    $projection.IntercompanyTransaction        =  ''
                                             and $projection.CompanyCode                    =  _ClearedAccount.CompanyCode
                                             and $projection.ClearingJournalEntry           =  _ClearedAccount.ClearingJournalEntry 
                                             and $projection.ClearingJournalEntryFiscalYear =  _ClearedAccount.ClearingJournalEntryFiscalYear )

// Use Case Intercompany Transaction: 

// It has been discussed and decided that Accounting Document Header information from Accounting Documents which 

// have not cleared any items should be shown on the Object Page    

  association [1..*] to C_AccountingDocument as _AccountingDocumentHeader
                                         on (    $projection.IntercompanyTransaction        <> ''
                                             and $projection.IntercompanyTransaction        =  _AccountingDocumentHeader.IntercompanyTransaction )
                                         or
                                            (    $projection.IntercompanyTransaction        =  ''
                                             and $projection.CompanyCode                    =  _AccountingDocumentHeader.CompanyCode
                                             and $projection.ClearingJournalEntry           =  _AccountingDocumentHeader.AccountingDocument
                                             and $projection.ClearingJournalEntryFiscalYear =  _AccountingDocumentHeader.FiscalYear )
                                             
  association [0..*] to C_ClearedItemCorrespondence as _ClearedItemCorrespondence
                                         on (    $projection.IntercompanyTransaction        <> ''
                                             and $projection.IntercompanyTransaction        =  _ClearedItemCorrespondence.IntercompanyTransaction )
                                         or
                                            (    $projection.IntercompanyTransaction        =  ''
                                             and $projection.CompanyCode                    =  _ClearedItemCorrespondence.CompanyCode
                                             and $projection.ClearingJournalEntry           =  _ClearedItemCorrespondence.ClearingJournalEntry
                                             and $projection.ClearingJournalEntryFiscalYear =  _ClearedItemCorrespondence.ClearingJournalEntryFiscalYear )                                 

//Unfortunately following association does not work with Smart Template, because Smart Template does not support ODATA requests like:

//C_ClearingDocument(ClearingJournalEntry='',CompanyCode='',ClearingJournalEntryFiscalYear='')/to_IntcoClrgDoc?$expand=to_ClearedItem

//                                           

//association [1..*] to _IntcoClrgDoc._ClearedItem as _IntcoClearedItem    //Self_And_IntcoClearedItems

//                                         on  $projection.CompanyCode                = _IntcoClearedItem.CompanyCode

//                                         and $projection.ClearingAccountingDocument = _IntcoClearedItem.ClearingAccountingDocument

//                                         and $projection.ClearingDocFiscalYear      = _IntcoClearedItem.ClearingDocFiscalYear

  
                                                           
{
      @UI.selectionField.position: 5
      @UI.lineItem: [{ position: 5, importance: #HIGH }]
      @UI.dataPoint: { title: 'Clearing Entry' }
      @Consumption.semanticObject: 'AccountingDocument' 
  key P_ClearingDocument.ClearingJournalEntry, 
      
      @UI.selectionField.position: 20
      @UI.lineItem: [{ position: 20, importance: #HIGH }]
      @UI.dataPoint: { title: 'Company Code' }
      @Consumption.valueHelpDefinition: [{ entity: { name:    'I_CompanyCodeVH', 
                                                     element: 'CompanyCode'   } }]
      @ObjectModel.text.association: '_CompanyCode'
      @UI.textArrangement: #TEXT_LAST
  key P_ClearingDocument.CompanyCode,

      @UI.selectionField.position: 25
      @UI.lineItem: [{ position: 25, importance: #HIGH }]
      @UI.dataPoint: { title: 'Fiscal Year' }
      @Consumption.semanticObject: 'FiscalYear'
  key P_ClearingDocument.ClearingJournalEntryFiscalYear,
  
      @UI.selectionField: [{ position: 100, exclude: true  }]
      @UI.fieldGroup: { qualifier: 'ClearingEntry', groupLabel: 'Clearing Entry', position: 40 }
      @UI.lineItem: [{ position: 100, exclude: true, importance: #LOW  }]
      @UI.dataPoint: { title: 'Intercompany Transaction' }
      // Actually, the fields ClearingJournalEntry, CompanyCode and ClearingJournalEntryFiscalYear are sufficient for the key. 

      // IntercompanyTransaction has been added to the key in order to solve a HANA memory consumption issue, 

      // which occurs when the cleared items are retrieved via the association _ClearedItem. 

      // When navigating for a clearing document from the worklist to the object page the value of the 

      // IntercompanyTransaction field needs to be passed in the ODATA request. Fiori Elements will do 

      // that only when IntercompanyTransaction is a key field. 

      // When the HANA optimizer knows, at the point in time when the plan is created, that the clearing document, 

      // for which the items should be retrieved, is not an intercompany clearing, than the HANA optimizer can create

      // for such a clearing a better plan, because it can push down the key fields as filter to the 

      // tables BSEG, ACDOCA, BSEG_ADD and further ones. 

      // This reduces the processed cleared items to the ones which belong to the clearing document only 

      // at a very early point in time during the query execution and this reduces the memory usage.

  key P_ClearingDocument.IntercompanyTransaction, 
  
      @UI.selectionField.position: 40
      @UI.lineItem: [{ position: 40, importance: #HIGH }]
      @Consumption.semanticObject: 'FiscalPeriod'
      P_ClearingDocument.ClearingFiscalPeriod,
      
      @UI.selectionField.position: 50
      @UI.lineItem: [{ position: 50, importance: #HIGH }]
      P_ClearingDocument.PostingDate,
      
      @UI.selectionField.position: 60
      @UI.lineItem: [{ position: 60, importance: #HIGH }]
      P_ClearingDocument.DocumentDate,
      
      @UI.selectionField: [{ position: 70, exclude: true  }]
      @UI.fieldGroup: { qualifier: 'ClearingEntry', groupLabel: 'Clearing Entry', position: 10 }
      @UI.lineItem: [{ position: 70, exclude: true, importance: #LOW }]
      P_ClearingDocument.ClearingCreationDate,

      @UI.selectionField: [{ position: 80, exclude: true  }]
      @UI.fieldGroup: { qualifier: 'ClearingEntry', groupLabel: 'Clearing Entry', position: 20 }
      @UI.lineItem: [{ position: 80, exclude: true, importance: #LOW  }]
      P_ClearingDocument.AccountingDocCreatedByUser,

      @UI.selectionField: [{ position: 90, exclude: true  }]
      @UI.fieldGroup: { qualifier: 'ClearingEntry', groupLabel: 'Clearing Entry', position: 30 }
      @UI.lineItem: [{ position: 90, exclude: true, importance: #LOW }]
      @Semantics:   { currencyCode: true }
      @Consumption.valueHelpDefinition: [{ entity: { name:    'I_CurrencyStdVH', 
                                                     element: 'Currency'   } }]
      P_ClearingDocument.CompanyCodeCurrency,
      
      @UI.selectionField: [{ position: 10, exclude: true  }]
      @UI.lineItem: [{ position: 10, exclude: true, importance: #LOW }]
      cast( P_ClearingDocument.ClearingJournalEntry as fis_augbl_depre  preserving type )                  as ClearingAccountingDocument,
      
      @UI.selectionField: [{ position: 30, exclude: true  }]
      @UI.lineItem: [{ position: 30, exclude: true, importance: #LOW }]
      cast( P_ClearingDocument.ClearingJournalEntryFiscalYear as fis_auggj_no_conv_depre preserving type ) as ClearingDocFiscalYear, 
      
      @UI.hidden: true
      P_ClearingDocument.AccountingDocumentType,
  
      @UI.hidden: true
      P_ClearingDocument.AuthorizationGroup,

      @UI.hidden: true
      0                                               as UxFcClearingIsResettable,
      @UI.hidden: true
      0                                               as UxFcClearingIsReversible,
      @UI.hidden: true
      0                                               as UxFcTaxReportingDate,
      @UI.hidden: true
      0                                               as UxFcDocumentDate,

      @UI.hidden: true
      case when _CorrespondenceCnt.NumberOfOpenCorrespondence = 0
          then 0
        when _CorrespondenceCnt.NumberOfOpenCorrespondence is null
          then 0
        else 3
      end                                             as UxFcClrgDocHasOpenCorrespnc,  
      
      _AccountingDocumentHeader,
      _ClearedItem,
      _ClearedAccount,
      _ClearedItemCorrespondence,
      _CompanyCode
}
where
      AccountingDocumentCategory <> 'V' // Parked document

  and AccountingDocumentCategory <> 'D' // Recurring document

  and AccountingDocumentCategory <> 'M' // Sample document                                                                                                                                                                                                                                              

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_CLEAREDITEMCORRESPONDENCECNT",
"P_CLEARINGDOCUMENT"
],
"ASSOCIATED":
[
"C_ACCOUNTINGDOCUMENT",
"C_CLEAREDACCOUNT",
"C_CLEAREDITEM",
"C_CLEAREDITEMCORRESPONDENCE",
"I_COMPANYCODE"
],
"BASE":
[
"P_CLEARINGDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/