P_CreditLimitUtilizationBseg1

DDL: P_CREDITLIMITUTILIZATIONBSEG1 SQL: PCREDLIMUTLBSEG1 Type: view COMPOSITE

P_CreditLimitUtilizationBseg1 is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_Customer, I_ReceivablesPayablesItem) and exposes 13 fields. It has 1 association to related views.

Data Sources (2)

SourceAliasJoin Type
I_Customer I_Customer inner
I_ReceivablesPayablesItem irpi from

Parameters (1)

NameTypeDefault
P_ReadLineItem read_fiar_lineitems

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_CreditControlArea _CreditControlArea $projection.CreditControlArea = _CreditControlArea.CreditControlArea

Annotations (5)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.sqlViewName PCREDLIMUTLBSEG1 view
VDM.private true view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (13)

KeyFieldSource TableSource FieldDescription
char10endasCreditSegment
BusinessPartner
Debtor I_ReceivablesPayablesItem Debtor
CreditControlArea I_ReceivablesPayablesItem CreditControlArea
AccountingDocument I_ReceivablesPayablesItem AccountingDocument
FiscalYear I_ReceivablesPayablesItem FiscalYear
SpecialGLCode I_ReceivablesPayablesItem SpecialGLCode
CreditLimitIsChecked
SpecialGLCodethen300else200endascomm_typ
FinancialAccountType FinancialAccountType
TransactionCurrency TransactionCurrency
AmountInTransactionCurrency AmountInTransactionCurrency
XBSEG
//@EndUserText.label: 'Customer Credit Utilization BSEG 1'

@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'PCREDLIMUTLBSEG1'
@VDM.private:true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck:  #NOT_REQUIRED
//@ObjectModel.representativeKey: ['CreditSegment' , 'BusinessPartner']

define view P_CreditLimitUtilizationBseg1
  with parameters
    P_ReadLineItem : read_fiar_lineitems
  as select from I_ReceivablesPayablesItem as irpi

  // get BusinessPartner for Customer

    inner join   I_Customer on irpi.Debtor = I_Customer.Customer

  association [0..1] to I_CreditControlArea as _CreditControlArea on $projection.CreditControlArea = _CreditControlArea.CreditControlArea
{
  case
    when _CreditControlArea._CreditControlArea2Segment.CreditSegment <> ''
      then cast( _CreditControlArea._CreditControlArea2Segment.CreditSegment as abap.char(10) )
  //      else '0000'

    end                                                                  as CreditSegment,

  ////    cast( I_Customer.BusinessPartner as abap.char(10)) as BusinessPartner,

  I_Customer._CustomerToBusinessPartner._BusinessPartner.BusinessPartner as BusinessPartner,

  irpi.Debtor,
  irpi.CreditControlArea,

  irpi.AccountingDocument,
  irpi.FiscalYear,
  irpi.SpecialGLCode,
  irpi._SpecialGLCode.CreditLimitIsChecked, //T074U-KLIMP Indicator: Take into Account for Credit Limit


  case
    when irpi.SpecialGLCode <> '' then '300'
    else '200'
  end                                                                    as comm_typ,

  FinancialAccountType,
  TransactionCurrency,
  AmountInTransactionCurrency,

  :P_ReadLineItem                                                        as XBSEG
}
where
          FinancialAccountType                                        =  'D'
  and     irpi.CreditControlArea                                      is not initial
  and     _CreditControlArea._CreditControlArea2Segment.CreditSegment <> ''
  and(
          ClearingDate                                                =  '00000000'
  )
  and(
    (
          irpi.SpecialGLCode != ''
      and irpi._SpecialGLCode.CreditLimitIsChecked                    =  'X'
    )
    or    irpi.SpecialGLCode                                          =  ''
  )
//  or ClearingDate > :P_ExchangeRateDate )      // nötig????

//and NetDueDate <= :P_ExchangeRateDate     // nötig????

//and AccountingDocumentCategory = ''    //??? nötig???  H_BSTAT

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BUSINESSPARTNER",
"I_CREDITCONTROLAREA",
"I_CREDITCONTROLAREA2SEGMENT",
"I_CUSTOMER",
"I_CUSTOMERTOBUSINESSPARTNER",
"I_RECEIVABLESPAYABLESITEM",
"I_SPECIALGLCODE"
],
"ASSOCIATED":
[
"I_CREDITCONTROLAREA"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/