P_CostRevenueReassignment

DDL: P_COSTREVENUEREASSIGNMENT SQL: PCOSREVREASSGMT Type: view COMPOSITE

P_CostRevenueReassignment is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_AccountAssignmentType) and exposes 26 fields with key fields FiscalYear, ReferenceDocument, ControllingArea, LedgerGLLineItem.

Data Sources (1)

SourceAliasJoin Type
I_AccountAssignmentType _AccountAssignmentType inner

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PCOSREVREASSGMT view
AbapCatalog.preserveKey true view
AbapCatalog.compiler.compareFilter true view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view

Fields (26)

KeyFieldSource TableSource FieldDescription
KEY FiscalYear FiscalYear
KEY ReferenceDocument ReferenceDocument
KEY ControllingArea ControllingArea
KEY LedgerGLLineItem LedgerGLLineItem
CompanyCode _Header CompanyCode
CompanyCodeName
SenderCompanyCode
AccountingDocument _Header AccountingDocument
AccountingDocumentHeaderText
DocumentDate DocumentDate
PostingDate PostingDate
FiscalPeriod
AccountingDocumentCreationDate
AccountingDocCreatedByUser
IsReversal IsReversal
IsReversed IsReversed
ReferenceDocumentType ReferenceDocumentType
ReferenceDocumentContext ReferenceDocumentContext
ExchangeRateDate
PredecessorReferenceDocument PredecessorReferenceDocument
ReversalReferenceDocument ReversalReferenceDocument
GlobalCurrency GlobalCurrency
AmountInGlobalCurrency
ControllingBusTransacType ControllingBusTransacType
IsSettled _Header IsSettled
_ReferenceDocumentType _ReferenceDocumentType
@AbapCatalog.sqlViewName: 'PCOSREVREASSGMT'
@AbapCatalog.preserveKey:true 
@AbapCatalog.compiler.compareFilter:true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
//@EndUserText.label: 'Cost Revenue Reassignment - private view'

define view P_CostRevenueReassignment
  as select distinct from I_GLAccountLineItemRawData as _Header 
    
  inner join I_AccountAssignmentType as _AccountAssignmentType
    on _AccountAssignmentType.AccountAssignmentType = _Header.AccountAssignmentType 
   
{
  key FiscalYear,      
      
  key ReferenceDocument,
  
  key ControllingArea,
  
  key LedgerGLLineItem,
      
      _Header.CompanyCode,
      _Header._CompanyCode.CompanyCodeName as CompanyCodeName,
      cast(_Header.PartnerCompanyCode as sendercompanycode) as SenderCompanyCode,
      _Header.AccountingDocument,
                   
      _Header._JournalEntry.AccountingDocumentHeaderText,
      
      DocumentDate,

      PostingDate,

      _Header._JournalEntry.FiscalPeriod,
      
      _Header._JournalEntry.AccountingDocumentCreationDate,
      
      cast(AccountingDocCreatedByUser as fco_cc_createdby) as AccountingDocCreatedByUser,
            
      IsReversal,
      IsReversed,      

      ReferenceDocumentType,  
      ReferenceDocumentContext,      
      
      cast(_Header._JournalEntry.ExchangeRateDate as fin_currconvdat) as ExchangeRateDate,
      
      PredecessorReferenceDocument,
      ReversalReferenceDocument, 
      cast(
        case _Header.IsReversal
            when '' then ''
            else _Header.ReversalReferenceDocument 
        end as reversedreferencedocument preserving type )  as ReversedReferenceDocument,     
      
      cast(
        case IsReversal
            when '' then '1'
            else '2'
      end as fco_posting_type) as AllocationPostingType, 
      
      @Semantics.currencyCode:true
      GlobalCurrency,
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      cast(AmountInGlobalCurrency as fis_ksl) as AmountInGlobalCurrency,
       
      ControllingBusTransacType,
      _Header.IsSettled,      
       
      _ReferenceDocumentType

}
where
  (
       ( ControllingBusTransacType = 'KAMV' and BusinessTransactionCategory = 'KAMV' )  
    or ( ControllingBusTransacType = 'RKU1' and BusinessTransactionCategory = 'RKU1' ) 
    or ( ControllingBusTransacType = 'RKU2' and BusinessTransactionCategory = 'RKU2' )        
  )
  and
  ReferenceDocumentType = 'COBK'
  and
  OriginCtrlgDebitCreditCode = 'S'
  and
  _Ledger.IsLeadingLedger = 'X'
  and _Header.LogicalSystem = '' 
  and _Header._JournalEntry.SenderLogicalSystem = '' 
  and (_Header.SourceLedger = _Header._JournalEntry.LedgerGroup or _Header._JournalEntry.LedgerGroup = '' )
  and _Header.IsSettlement = ''