P_SettlementActualSettledValue

DDL: P_SETTLEMENTACTUALSETTLEDVALUE SQL: PSETTLMTACTVAL Type: view CONSUMPTION

P_SettlementActualSettledValue is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (I_GLAccountLineItemRawData, P_SettlmtSndrDoc) and exposes 62 fields with key fields CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem, Ledger. It has 3 associations to related views.

Data Sources (2)

SourceAliasJoin Type
I_GLAccountLineItemRawData _JournalEntryItem inner
P_SettlmtSndrDoc _SettlmtSndrDoc from

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_AccountAssignmentTypeT _SettlementReceiverTypeT _SettlementReceiverTypeT.AccountAssignmentType = $projection.SettlementReceiverType and _SettlementReceiverTypeT.Language = $session.system_language
[0..1] I_WBSElementBasicData _WBSElementBasicData $projection.WBSElementInternalID = _WBSElementBasicData.WBSElementInternalID
[0..1] I_Order _OrderSender $projection.ControllingObject = _OrderSender.ObjectInternalID

Annotations (7)

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

Fields (62)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_GLAccountLineItemRawData CompanyCode
KEY FiscalYear I_GLAccountLineItemRawData FiscalYear
KEY AccountingDocument I_GLAccountLineItemRawData AccountingDocument
KEY LedgerGLLineItem I_GLAccountLineItemRawData LedgerGLLineItem
KEY Ledger I_GLAccountLineItemRawData SourceLedger
ControllingSettlementDocument P_SettlmtSndrDoc ControllingSettlementDocument
ControllingObject P_SettlmtSndrDoc ControllingObject
WBSElementInternalID P_SettlmtSndrDoc WBSElementInternalID
ProjectInternalID P_SettlmtSndrDoc ProjectInternalID
SettlementSenderObject P_SettlmtSndrDoc SettlementSenderObject
SettlementSenderType
SettlementSenderTypeText
SettlementType SettlementType
SettlementReceiverText
OriginObjectType I_GLAccountLineItemRawData OriginObjectType
OriginCtrlgDebitCreditCode I_GLAccountLineItemRawData OriginCtrlgDebitCreditCode
FixedAssetelseendasfis_anln2asFixedAsset
ProductelseendasproductnumberasProduct
GLAccountelseendasfis_racctasGLAccount
ControllingArea I_GLAccountLineItemRawData ControllingArea
SalesDocument I_GLAccountLineItemRawData SalesDocument
SalesDocumentItem I_GLAccountLineItemRawData SalesDocumentItem
CostCenterelseendasfis_kostlasCostCenter
OrderID I_GLAccountLineItemRawData OrderID
ProjectNetwork I_GLAccountLineItemRawData ProjectNetwork
BusinessProcess I_GLAccountLineItemRawData BusinessProcess
AccountAssignmentType I_GLAccountLineItemRawData AccountAssignmentType
PartnerAccountAssignmentType I_GLAccountLineItemRawData PartnerAccountAssignmentType
FunctionalArea
Fund
BudgetPeriod
GrantID
PartnerFunctionalArea
PartnerFund
PartnerBudgetPeriod
PartnerGrant
CompanyCodeCurrency CompanyCodeCurrency
AmountInCompanyCodeCurrency AmountInCompanyCodeCurrency
GlobalCurrency GlobalCurrency
AmountInGlobalCurrency AmountInGlobalCurrency
ControllingObjectCurrency ControllingObjectCurrency
AmountInObjectCurrency AmountInObjectCurrency
AmountInFreeDefinedCurrency1 AmountInFreeDefinedCurrency1
FreeDefinedCurrency1 FreeDefinedCurrency1
AmountInFreeDefinedCurrency2 AmountInFreeDefinedCurrency2
FreeDefinedCurrency2 FreeDefinedCurrency2
AmountInFreeDefinedCurrency3 AmountInFreeDefinedCurrency3
FreeDefinedCurrency3 FreeDefinedCurrency3
AmountInFreeDefinedCurrency4 AmountInFreeDefinedCurrency4
FreeDefinedCurrency4 FreeDefinedCurrency4
AmountInFreeDefinedCurrency5 AmountInFreeDefinedCurrency5
FreeDefinedCurrency5 FreeDefinedCurrency5
AmountInFreeDefinedCurrency6 AmountInFreeDefinedCurrency6
FreeDefinedCurrency6 FreeDefinedCurrency6
AmountInFreeDefinedCurrency7 AmountInFreeDefinedCurrency7
FreeDefinedCurrency7 FreeDefinedCurrency7
AmountInFreeDefinedCurrency8 AmountInFreeDefinedCurrency8
FreeDefinedCurrency8 FreeDefinedCurrency8
AmountInFunctionalCurrency AmountInFunctionalCurrency
FunctionalCurrency FunctionalCurrency
_SettlementReceiverTypeT _SettlementReceiverTypeT
_SettlementTypeText _SettlementTypeText
@AbapCatalog.sqlViewName: 'PSETTLMTACTVAL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #CONSUMPTION
@VDM.private: true

define view P_SettlementActualSettledValue
  as select from    P_SettlmtSndrDoc           as _SettlmtSndrDoc
    inner join      I_GLAccountLineItemRawData as _JournalEntryItem on  _JournalEntryItem.ReferenceDocument     = _SettlmtSndrDoc.ControllingSettlementDocument
                                                                    and _JournalEntryItem.ReferenceDocumentType = 'AUAK'
                                                                         

  association [0..1] to I_AccountAssignmentTypeT     as _SettlementReceiverTypeT    on  _SettlementReceiverTypeT.AccountAssignmentType = $projection.SettlementReceiverType
                                                                                    and _SettlementReceiverTypeT.Language              = $session.system_language
  association [0..1] to I_WBSElementBasicData        as _WBSElementBasicData        on  $projection.WBSElementInternalID = _WBSElementBasicData.WBSElementInternalID
  association [0..1] to I_Order                      as _OrderSender                on  $projection.ControllingObject = _OrderSender.ObjectInternalID
{

  key _JournalEntryItem.CompanyCode,
  key _JournalEntryItem.FiscalYear,
  key _JournalEntryItem.AccountingDocument,
  key _JournalEntryItem.LedgerGLLineItem,
  key _JournalEntryItem.SourceLedger                                                                        as Ledger,

      _SettlmtSndrDoc.ControllingSettlementDocument,
      _SettlmtSndrDoc.ControllingObject,
      _SettlmtSndrDoc.WBSElementInternalID,
      _SettlmtSndrDoc.ProjectInternalID,
      _SettlmtSndrDoc.SettlementSenderObject,
      cast( _SettlmtSndrDoc.SettlementSenderType as fco_settlmt_snd_type)                                   as SettlementSenderType,
      cast( _SettlmtSndrDoc._SettlementSenderTypeT.AccountAssignmentTypeName as fco_settlmt_snd_type_text ) as SettlementSenderTypeText,

      cast(
      case OriginObjectType
        when '22' then concat(concat(concat(concat(CompanyCode, '/'), MasterFixedAsset), '/'), FixedAsset)
        when '35' then concat(concat(concat(concat(CompanyCode, '/'), _JournalEntryItem.BusinessArea), '/'), GLAccount)
        else
        case when OriginCtrlgDebitCreditCode = ' ' or OriginCtrlgDebitCreditCode = 'S'
          then AccountAssignment
          else PartnerAccountAssignment
        end
      end as fco_stlmnt_receiver_id_out )                                                                   as SettlementReceiverObject,

      cast(
      case OriginObjectType
        when '22' then 'AN'
        when '35' then 'SK'
        else
        case when OriginCtrlgDebitCreditCode = '' or OriginCtrlgDebitCreditCode = 'S'
          then _JournalEntryItem.AccountAssignmentType
          else _JournalEntryItem.PartnerAccountAssignmentType
        end
      end as fco_settlmt_rec_type )                                                                         as SettlementReceiverType,

      SettlementType,

      cast( case SettlementSenderType when 'OR' then _OrderSender.OrderDescription
                                      when 'PR' then _WBSElementBasicData.WBSDescription
            end as fco_stlmnt_sender_txt )                                                                  as SettlementSenderText,

      cast( '' as fco_stlmnt_receiver_txt )                                                                 as SettlementReceiverText, 
      
      // data needed for virtual element

      _JournalEntryItem.OriginObjectType,  
      _JournalEntryItem.OriginCtrlgDebitCreditCode,   
      
      //for asset - type 22

      cast( case _JournalEntryItem.OriginObjectType
             when '22' then _JournalEntryItem.FixedAsset
             else ''
           end as fis_anln2 )                                                                               as FixedAsset,
//      _JournalEntryItem.FixedAsset as FixedAsset,

      cast( case _JournalEntryItem.OriginObjectType
             when '22' then _JournalEntryItem.MasterFixedAsset
             else ''
           end as fis_anln1 )                                                                               as MasterFixedAsset,
//      _JournalEntryItem.MasterFixedAsset as MasterFixedAsset,


      //Product 

      cast(case when ( _JournalEntryItem.OriginCtrlgDebitCreditCode = '' or _JournalEntryItem.OriginCtrlgDebitCreditCode = 'S' )
                     and _JournalEntryItem.AccountAssignmentType = 'MA'
                     or
                     _JournalEntryItem.OriginCtrlgDebitCreditCode <> '' and _JournalEntryItem.OriginCtrlgDebitCreditCode <> 'S'
                     and _JournalEntryItem.PartnerAccountAssignmentType = 'MA'
             then _JournalEntryItem.Product
             else ''
             end as productnumber )                                                                         as Product,    
//      _JournalEntryItem.Product,

      
      //for GL acct - type 35

      cast( case _JournalEntryItem.OriginObjectType
             when '35' then _JournalEntryItem.GLAccount
             else ''
           end as fis_racct )                                                                               as GLAccount,      
//      _JournalEntryItem.GLAccount,


      _JournalEntryItem.ControllingArea,
      
      _JournalEntryItem.SalesDocument,
      _JournalEntryItem.SalesDocumentItem,
      
      cast(case when ( _JournalEntryItem.OriginCtrlgDebitCreditCode = '' or _JournalEntryItem.OriginCtrlgDebitCreditCode = 'S' )
                     and _JournalEntryItem.AccountAssignmentType = 'KS'
                     or
                     _JournalEntryItem.OriginCtrlgDebitCreditCode <> '' and _JournalEntryItem.OriginCtrlgDebitCreditCode <> 'S'
                     and _JournalEntryItem.PartnerAccountAssignmentType = 'KS'
             then _JournalEntryItem.CostCenter
             else ''
             end as fis_kostl )                                                                             as CostCenter,    
//      _JournalEntryItem.CostCenter,

                                          
      _JournalEntryItem.OrderID,
      _JournalEntryItem.ProjectNetwork,
      _JournalEntryItem.BusinessProcess,
      
      _JournalEntryItem.AccountAssignmentType,
      _JournalEntryItem.PartnerAccountAssignmentType,
      

      cast( FunctionalArea as fm_efarea preserving type )                                                   as FunctionalArea,
      cast( Fund as fm_efonds preserving type )                                                             as Fund,
      cast( BudgetPeriod as fm_ebudget_period preserving type )                                             as BudgetPeriod,
      cast( GrantID as gm_grant_receiver preserving type )                                                  as GrantID,

      cast(PartnerFunctionalArea as fm_sfarea)                                                              as PartnerFunctionalArea,
      cast(PartnerFund as fm_sfonds)                                                                        as PartnerFund,
      cast(PartnerBudgetPeriod as fm_sbudget_period)                                                        as PartnerBudgetPeriod,
      cast(PartnerGrant as gm_grant_sender)                                                                 as PartnerGrant,


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

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

      @Semantics.currencyCode:true
      ControllingObjectCurrency,
      @Semantics: { amount : {currencyCode: 'ControllingObjectCurrency'} }
      AmountInObjectCurrency,

      /* free defined currencies */
      @Semantics.amount.currencyCode: 'FreeDefinedCurrency1'
      AmountInFreeDefinedCurrency1,
      @Semantics.currencyCode       : true
      FreeDefinedCurrency1,

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

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

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

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

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

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

      @Semantics.amount.currencyCode: 'FreeDefinedCurrency8'
      AmountInFreeDefinedCurrency8,
      @Semantics.currencyCode       : true
      FreeDefinedCurrency8,
      
      @Semantics.amount.currencyCode: 'FunctionalCurrency'
      AmountInFunctionalCurrency,
      @Semantics.currencyCode       : true
      FunctionalCurrency,

      _SettlementReceiverTypeT,
      _SettlementTypeText

}
where
        OriginObjectType <> '22' and OriginObjectType <> '35' and OriginCtrlgDebitCreditCode = 'S' 
    or  OriginObjectType = '35' and OriginCtrlgDebitCreditCode = '' and DebitCreditCode = 'S' 
    or  OriginObjectType = '22' and BusinessTransactionType    = 'ZUCO'
    or  OriginObjectType = '22' and BusinessTransactionType    = 'AUUZ'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACCOUNTASSIGNMENTTYPET",
"I_GLACCOUNTLINEITEMRAWDATA",
"I_ORDER",
"I_WBSELEMENTBASICDATA",
"P_SETTLMTSNDRDOC"
],
"ASSOCIATED":
[
"I_ACCOUNTASSIGNMENTTYPET",
"I_ORDER",
"I_SETTLEMENTTYPETEXT",
"I_WBSELEMENTBASICDATA"
],
"BASE":
[
"P_SETTLMTSNDRDOC"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/