P_CrExp

DDL: P_CREXP SQL: PCREXP Type: view COMPOSITE

P_CrExp is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_OperationalAcctgDocItem, I_Customer) and exposes 18 fields. It has 2 associations to related views.

Data Sources (2)

SourceAliasJoin Type
I_OperationalAcctgDocItem _AccountingDocument from
I_Customer I_Customer inner

Associations (2)

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

Annotations (6)

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

Fields (18)

KeyFieldSource TableSource FieldDescription
BusinessPartner
CreditSegment
xBseg
CreditControlArea I_OperationalAcctgDocItem CreditControlArea
Customer I_OperationalAcctgDocItem Customer
AccountingDocument I_OperationalAcctgDocItem AccountingDocument
FiscalYear I_OperationalAcctgDocItem FiscalYear
SpecialGLCode I_OperationalAcctgDocItem SpecialGLCode
CreditLimitIsChecked
FinancialAccountType I_OperationalAcctgDocItem FinancialAccountType
TransactionCurrency I_OperationalAcctgDocItem TransactionCurrency
AmountInTransactionCurrency I_OperationalAcctgDocItem AmountInTransactionCurrency
CreditControlAreaCurrency I_OperationalAcctgDocItem CreditControlAreaCurrency
HedgedAmount I_OperationalAcctgDocItem HedgedAmount
CreditSegmentCurrency
CrdtSgmtIsAddedToMainSgmt
_CreditExposureCategory _CreditExposureCategory
_CreditControlArea _CreditControlArea
//@EndUserText.label: 'FI Credit Exposure BSEG'

@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'PCREXP'
@VDM.private:true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck:  #NOT_REQUIRED
@AbapCatalog.compiler.compareFilter:true
define view P_CrExp

  as select from I_OperationalAcctgDocItem as _AccountingDocument
  // Link with Customer

    inner join   I_Customer on _AccountingDocument.Customer = I_Customer.Customer

  // Link with Credit Control Area/Credit Segment mapping

  association [0..1] to I_CreditControlArea      as _CreditControlArea      on $projection.CreditControlArea = _CreditControlArea.CreditControlArea

  // Link to exposure type customizing

  association [1..1] to I_CreditExposureCategory as _CreditExposureCategory on $projection.CreditExposureCategory = _CreditExposureCategory.CreditExposureCategory

{
  // Business Partner

  I_Customer._CustomerToBusinessPartner._BusinessPartner.BusinessPartner             as BusinessPartner,

  // Credit Segment

  _CreditControlArea._CreditControlArea2Segment.CreditSegment                        as CreditSegment,

  'Y'                                                                                as xBseg,

  // Credit Control Area

  _AccountingDocument.CreditControlArea,

  // Original Customer

  _AccountingDocument.Customer,

  //  I_Customer._CustomerToBusinessPartner._BusinessPartner._BusinessPartnerRole [1:BusinessPartnerRole = 'UKM000'].BusinessPartnerRole as BusinessPartnerRole,


  // Accounting Document Number

  _AccountingDocument.AccountingDocument,

  // Fiscal Year

  _AccountingDocument.FiscalYear,

  // Special G/L Indicator

  _AccountingDocument.SpecialGLCode,

  // Check if value is relevant for Credit Management - T074U-KLIMP

  _AccountingDocument._SpecialGLCode.CreditLimitIsChecked,

  // Case Exposure Category

  case
  // Special Exposure

    when _AccountingDocument.SpecialGLCode <> ''
    then '300'

  // FI Exposure

    else '200'
  end                                                                                as CreditExposureCategory,

  // Document Type

  _AccountingDocument.FinancialAccountType,

  // Transaction Currency

  @Semantics.currencyCode: true
  _AccountingDocument.TransactionCurrency,
  // Amount in Transaction Currency

  @Semantics.amount.currencyCode: 'TransactionCurrency'
  _AccountingDocument.AmountInTransactionCurrency,


  // Credit Control Area Currency

  @Semantics.currencyCode: true
  _AccountingDocument.CreditControlAreaCurrency,
  @Semantics.amount.currencyCode: 'CreditControlAreaCurrency'
  _AccountingDocument.HedgedAmount,

  @Semantics.currencyCode: true
  _CreditControlArea._CreditControlArea2Segment._CreditSegment.CreditSegmentCurrency as CreditSegmentCurrency,

  _CreditControlArea._CreditControlArea2Segment._CreditSegment.CrdtSgmtIsAddedToMainSgmt,

  // Publish associations

  _CreditExposureCategory,
  _CreditControlArea
}
where
          _AccountingDocument.FinancialAccountType                                                                                           =  'D'
  and     _AccountingDocument.CreditControlArea                                                                                              is not initial
  and     _CreditControlArea._CreditControlArea2Segment.CreditSegment                                                                        <> ''
  and     _CreditControlArea._CreditControlArea2Segment._CreditSegment.CreditSegmentCurrency                                                 <> ''
  and(
          _AccountingDocument.ClearingDate                                                                                                   =  '00000000'
  )
  and(
    (
          _AccountingDocument.SpecialGLCode != ''
      and _AccountingDocument._SpecialGLCode.CreditLimitIsChecked                                                                            =  'X'
    )
    or    _AccountingDocument.SpecialGLCode                                                                                                  =  ''
  )

  and(
          _AccountingDocument._PaymentDifferenceReason.IsDisputed                                                                            =  ''
    or    _AccountingDocument._PaymentDifferenceReason.IsDisputed                                                                            is initial
    or    _AccountingDocument._PaymentDifferenceReason.IsDisputed                                                                            is null
  )

//  and     I_Customer._CustomerToBusinessPartner._BusinessPartner.BusinessPartner                                                             is not initial

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